Browse Source

Revert "Remove wildcard imports"

This reverts commit 7a835df953c8d84102a43c65ef90c5f80c21f06a.
Rafał Pitoń 7 years ago
parent
commit
357c0dd1c9

+ 4 - 25
misago/threads/permissions/__init__.py

@@ -1,25 +1,4 @@
-from .bestanswers import (
-    allow_change_best_answer, allow_delete_best_answer, allow_hide_best_answer,
-    allow_mark_as_best_answer, allow_mark_best_answer, allow_unmark_best_answer,
-    can_change_best_answer, can_delete_best_answer, can_hide_best_answer,
-    can_mark_as_best_answer, can_mark_best_answer, can_unmark_best_answer)
-from .privatethreads import (
-    allow_add_participant, allow_add_participants, allow_change_owner, allow_message_user,
-    allow_remove_participant, allow_see_private_thread, allow_use_private_threads,
-    can_add_participant, can_add_participants, can_change_owner, can_message_user,
-    can_remove_participant, can_see_private_thread, can_use_private_threads)
-from .threads import (
-    allow_approve_post, allow_approve_thread, allow_delete_event, allow_delete_post,
-    allow_delete_thread, allow_edit_post, allow_edit_thread, allow_hide_event, allow_hide_post,
-    allow_hide_thread, allow_merge_post, allow_merge_thread, allow_move_post, allow_move_thread,
-    allow_pin_thread, allow_protect_post, allow_reply_thread, allow_see_post, allow_see_thread,
-    allow_split_post, allow_start_thread, allow_unhide_event, allow_unhide_post,
-    allow_unhide_thread, can_approve_post, can_approve_thread, can_delete_event, can_delete_post,
-    can_delete_thread, can_edit_post, can_edit_thread, can_hide_event, can_hide_post,
-    can_hide_thread, can_merge_post, can_merge_thread, can_move_post, can_move_thread,
-    can_pin_thread, can_protect_post, can_reply_thread, can_see_post, can_see_thread,
-    can_split_post, can_start_thread, can_unhide_event, can_unhide_post, can_unhide_thread,
-    exclude_invisible_posts, exclude_invisible_threads)
-from .polls import (
-    allow_delete_poll, allow_edit_poll, allow_see_poll_votes, allow_start_poll, allow_vote_poll,
-    can_delete_poll, can_edit_poll, can_see_poll_votes, can_start_poll, can_vote_poll)
+from .bestanswers import *
+from .privatethreads import *
+from .threads import *
+from .polls import *

+ 14 - 0
misago/threads/permissions/bestanswers.py

@@ -11,6 +11,20 @@ from misago.core.forms import YesNoSwitch
 from misago.threads.models import Post, Thread
 
 
+__all__nope = [
+    'allow_mark_best_answer',
+    'can_mark_best_answer',
+    'allow_mark_as_best_answer',
+    'can_mark_as_best_answer',
+    'allow_unmark_best_answer',
+    'can_unmark_best_answer',
+    'allow_hide_best_answer',
+    'can_hide_best_answer',
+    'allow_delete_best_answer',
+    'can_delete_best_answer',
+]
+
+
 class CategoryPermissionsForm(forms.Form):
     legend = _("Best answers")
 

+ 14 - 0
misago/threads/permissions/polls.py

@@ -11,6 +11,20 @@ from misago.core.forms import YesNoSwitch
 from misago.threads.models import Poll, Thread
 
 
+__all__ = [
+    'allow_start_poll',
+    'can_start_poll',
+    'allow_edit_poll',
+    'can_edit_poll',
+    'allow_delete_poll',
+    'can_delete_poll',
+    'allow_vote_poll',
+    'can_vote_poll',
+    'allow_see_poll_votes',
+    'can_see_poll_votes',
+]
+
+
 class RolePermissionsForm(forms.Form):
     legend = _("Polls")
 

+ 18 - 0
misago/threads/permissions/privatethreads.py

@@ -11,6 +11,24 @@ from misago.core.forms import YesNoSwitch
 from misago.threads.models import Thread
 
 
+__all__ = [
+    'allow_use_private_threads',
+    'can_use_private_threads',
+    'allow_see_private_thread',
+    'can_see_private_thread',
+    'allow_change_owner',
+    'can_change_owner',
+    'allow_add_participants',
+    'can_add_participants',
+    'allow_remove_participant',
+    'can_remove_participant',
+    'allow_add_participant',
+    'can_add_participant',
+    'allow_message_user',
+    'can_message_user',
+]
+
+
 class PermissionsForm(forms.Form):
     legend = _("Private threads")
 

+ 54 - 0
misago/threads/permissions/threads.py

@@ -14,6 +14,60 @@ from misago.core.forms import YesNoSwitch
 from misago.threads.models import Post, Thread
 
 
+__all__ = [
+    'allow_see_thread',
+    'can_see_thread',
+    'allow_start_thread',
+    'can_start_thread',
+    'allow_reply_thread',
+    'can_reply_thread',
+    'allow_edit_thread',
+    'can_edit_thread',
+    'allow_pin_thread',
+    'can_pin_thread',
+    'allow_unhide_thread',
+    'can_unhide_thread',
+    'allow_hide_thread',
+    'can_hide_thread',
+    'allow_delete_thread',
+    'can_delete_thread',
+    'allow_move_thread',
+    'can_move_thread',
+    'allow_merge_thread',
+    'can_merge_thread',
+    'allow_approve_thread',
+    'can_approve_thread',
+    'allow_see_post',
+    'can_see_post',
+    'allow_edit_post',
+    'can_edit_post',
+    'allow_unhide_post',
+    'can_unhide_post',
+    'allow_hide_post',
+    'can_hide_post',
+    'allow_delete_post',
+    'can_delete_post',
+    'allow_protect_post',
+    'can_protect_post',
+    'allow_approve_post',
+    'can_approve_post',
+    'allow_move_post',
+    'can_move_post',
+    'allow_merge_post',
+    'can_merge_post',
+    'allow_unhide_event',
+    'can_unhide_event',
+    'allow_split_post',
+    'can_split_post',
+    'allow_hide_event',
+    'can_hide_event',
+    'allow_delete_event',
+    'can_delete_event',
+    'exclude_invisible_threads',
+    'exclude_invisible_posts',
+]
+
+
 class RolePermissionsForm(forms.Form):
     legend = _("Threads")
 

+ 5 - 5
misago/threads/viewmodels/__init__.py

@@ -1,5 +1,5 @@
-from .category import ThreadsRootCategory, ThreadsCategory, PrivateThreadsCategory
-from .post import ThreadPost
-from .posts import ThreadPosts
-from .thread import ForumThread, PrivateThread
-from .threads import ForumThreads, PrivateThreads, filter_read_threads_queryset
+from .category import *
+from .post import *
+from .posts import *
+from .thread import *
+from .threads import *

+ 3 - 0
misago/threads/viewmodels/category.py

@@ -9,6 +9,9 @@ from misago.core.viewmodel import ViewModel as BaseViewModel
 from misago.threads.permissions import allow_use_private_threads
 
 
+__all__ = ['ThreadsRootCategory', 'ThreadsCategory', 'PrivateThreadsCategory']
+
+
 class ViewModel(BaseViewModel):
     def __init__(self, request, **kwargs):
         self._categories = self.get_categories(request)

+ 3 - 0
misago/threads/viewmodels/post.py

@@ -5,6 +5,9 @@ from misago.core.viewmodel import ViewModel as BaseViewModel
 from misago.threads.permissions import exclude_invisible_posts
 
 
+__all__ = ['ThreadPost']
+
+
 class ViewModel(BaseViewModel):
     def __init__(self, request, thread, pk):
         model = self.get_post(request, thread, pk)

+ 3 - 0
misago/threads/viewmodels/posts.py

@@ -9,6 +9,9 @@ from misago.threads.utils import add_likes_to_posts
 from misago.users.online.utils import make_users_status_aware
 
 
+__all__ = ['ThreadPosts']
+
+
 class ViewModel(object):
     def __init__(self, request, thread, page):
         try:

+ 2 - 0
misago/threads/viewmodels/thread.py

@@ -15,6 +15,8 @@ from misago.threads.subscriptions import make_subscription_aware
 from misago.threads.threadtypes import trees_map
 
 
+__all__ = ['ForumThread', 'PrivateThread']
+
 BASE_RELATIONS = [
     'category',
     'poll',

+ 2 - 0
misago/threads/viewmodels/threads.py

@@ -20,6 +20,8 @@ from misago.threads.subscriptions import make_subscription_aware
 from misago.threads.utils import add_categories_to_items
 
 
+__all__ = ['ForumThreads', 'PrivateThreads', 'filter_read_threads_queryset']
+
 LISTS_NAMES = {
     'all': None,
     'my': ugettext_lazy("Your threads"),

+ 4 - 10
misago/users/permissions/__init__.py

@@ -1,10 +1,4 @@
-from .decorators import anonymous_only, authenticated_only
-from .delete import (
-    allow_delete_own_account, allow_delete_user, can_delete_own_account, can_delete_user)
-from .moderation import (
-    allow_rename_user, allow_ban_user, allow_edit_profile_details, allow_lift_ban,
-    allow_moderate_avatar, allow_moderate_signature, can_ban_user, can_edit_profile_details,
-    can_lift_ban, can_moderate_avatar, can_moderate_signature, can_rename_user)
-from .profiles import (
-    allow_block_user, allow_browse_users_list, allow_follow_user, allow_see_ban_details,
-    can_block_user, can_browse_users_list, can_follow_user, can_see_ban_details)
+from .decorators import *
+from .delete import *
+from .moderation import *
+from .profiles import *

+ 6 - 0
misago/users/permissions/decorators.py

@@ -2,6 +2,12 @@ from django.core.exceptions import PermissionDenied
 from django.utils.translation import ugettext_lazy as _
 
 
+__all__ = [
+    'authenticated_only',
+    'anonymous_only',
+]
+
+
 def authenticated_only(f):
     def perm_decorator(user, target):
         if user.is_authenticated:

+ 8 - 0
misago/users/permissions/delete.py

@@ -13,6 +13,14 @@ from misago.acl.models import Role
 from misago.conf import settings
 
 
+__all__ = [
+    'allow_delete_user',
+    'can_delete_user',
+    'allow_delete_own_account',
+    'can_delete_own_account',
+]
+
+
 class PermissionsForm(forms.Form):
     legend = _("Deleting users")
 

+ 16 - 0
misago/users/permissions/moderation.py

@@ -14,6 +14,22 @@ from misago.core.forms import YesNoSwitch
 from misago.users.bans import get_user_ban
 
 
+__all__ = [
+    'allow_rename_user',
+    'can_rename_user',
+    'allow_moderate_avatar',
+    'can_moderate_avatar',
+    'allow_moderate_signature',
+    'can_moderate_signature',
+    'allow_edit_profile_details',
+    'can_edit_profile_details',
+    'allow_ban_user',
+    'can_ban_user',
+    'allow_lift_ban',
+    'can_lift_ban',
+]
+
+
 class PermissionsForm(forms.Form):
     legend = _("Users moderation")
 

+ 11 - 0
misago/users/permissions/profiles.py

@@ -11,6 +11,17 @@ from misago.core.forms import YesNoSwitch
 from .decorators import authenticated_only
 
 
+__all__ = [
+    'allow_browse_users_list',
+    'can_browse_users_list',
+    'allow_follow_user',
+    'can_follow_user',
+    'allow_block_user',
+    'can_block_user',
+    'allow_see_ban_details',
+    'can_see_ban_details',
+]
+
 CAN_BROWSE_USERS_LIST = YesNoSwitch(label=_("Can browse users list"), initial=1)
 CAN_SEARCH_USERS = YesNoSwitch(label=_("Can search user profiles"), initial=1)
 CAN_SEE_USER_NAME_HISTORY = YesNoSwitch(label=_("Can see other members name history"))

+ 1 - 2
misago/users/profilefields/__init__.py

@@ -10,8 +10,7 @@ from django.utils.translation import ugettext as _
 
 from misago.conf import settings
 
-from .basefields import (
-    ChoiceProfileField, ProfileField, TextareaProfileField, TextProfileField, UrlProfileField)
+from .basefields import *
 from .serializers import serialize_profilefields_data
 
 

+ 10 - 1
misago/users/profilefields/basefields.py

@@ -6,6 +6,15 @@ from django.utils.six import text_type
 from misago.core.utils import format_plaintext_for_html
 
 
+__all__ = [
+    'ProfileField',
+    'TextProfileField',
+    'UrlProfileField',
+    'TextareaProfileField',
+    'ChoiceProfileField',
+]
+
+
 class ProfileField(object):
     """
     Basic profile field
@@ -86,7 +95,7 @@ class ChoiceProfileField(ProfileField):
                 "profile field ChoiceProfileField has to define "
                 "choices attribute or get_choices(user) method"
             )
-        return self.choices or []
+        return self.choices
 
     def get_form_field(self, request, user):
         return forms.ChoiceField(