Browse Source

#702: even greater accuracy for fixdictsformatting

Rafał Pitoń 8 years ago
parent
commit
beae568547

+ 5 - 1
extras/fixdictsformatting.py

@@ -112,7 +112,11 @@ def walk_dedent_tree_node(node, children, force_split_next=False):
         if node.type == token.STRING:
             strings_tuple = node.parent.parent
 
-            container = strings_tuple.parent.children[0]
+            # compute indent
+            if force_split_next:
+                container = strings_tuple.parent.children[0]
+            else:
+                container = strings_tuple.parent.parent.children[0]
             while isinstance(container, Node):
                 container = container.children[0]
             indent = container.column + 4

+ 4 - 5
misago/core/migrations/0002_basic_settings.py

@@ -34,9 +34,9 @@ def create_basic_settings_group(apps, schema_editor):
                     'setting': 'forum_index_title',
                     'name': _("Index title"),
                     'description': _(
-    "You may set custon title on "
-    "forum index by typing it here."
-),
+                        "You may set custon title on "
+                        "forum index by typing it here."
+                    ),
                     'legend': _("Forum index"),
                     'field_extra': {
                         'max_length': 255
@@ -75,8 +75,7 @@ def create_basic_settings_group(apps, schema_editor):
                     'setting': 'email_footer',
                     'name': _("E-mails footer"),
                     'description': _(
-                        "Optional short message included at "
-                        "the end of e-mails sent by forum."
+                        "Optional short message included at the end of e-mails sent by forum."
                     ),
                     'legend': _("Forum e-mails"),
                     'field_extra': {

+ 5 - 8
misago/legal/migrations/0001_initial.py

@@ -15,9 +15,8 @@ def create_legal_settings_group(apps, schema_editor):
             'key': 'legal',
             'name': _("Legal information"),
             'description': _(
-    "Those settings allow you to set forum terms of "
-    "service and privacy policy"
-),
+                "Those settings allow you to set forum terms of service and privacy policy."
+            ),
             'settings': [
                 {
                     'setting': 'terms_of_service_title',
@@ -35,8 +34,7 @@ def create_legal_settings_group(apps, schema_editor):
                     'setting': 'terms_of_service_link',
                     'name': _("Terms link"),
                     'description': _(
-                        "If terms of service are located "
-                        "on other page, enter there its link."
+                        "If terms of service are located on other page, enter there its link."
                     ),
                     'value': "",
                     'field_extra': {
@@ -80,9 +78,8 @@ def create_legal_settings_group(apps, schema_editor):
                     'setting': 'privacy_policy_link',
                     'name': _("Policy link"),
                     'description': _(
-    "If privacy policy is located on "
-    "other page, enter there its link."
-),
+                        "If privacy policy is located on other page, enter there its link."
+                    ),
                     'value': "",
                     'field_extra': {
                         'max_length': 255,

+ 6 - 4
misago/threads/api/threadendpoints/merge.py

@@ -176,7 +176,7 @@ def merge_threads(request, validated_data, threads, poll):
     new_thread = Thread(
         category=validated_data['category'],
         started_on=threads[0].started_on,
-        last_post_on=threads[0].last_post_on
+        last_post_on=threads[0].last_post_on,
     )
 
     new_thread.set_title(validated_data['title'])
@@ -194,7 +194,8 @@ def merge_threads(request, validated_data, threads, poll):
         record_event(
             request, new_thread, 'merged', {
                 'merged_thread': thread.title,
-            }, commit=False
+            },
+            commit=False,
         )
 
     new_thread.synchronize()
@@ -223,8 +224,9 @@ def merge_threads(request, validated_data, threads, poll):
     # add top category to thread
     if validated_data.get('top_category'):
         categories = list(
-            Category.objects.all_categories()
-            .filter(id__in=request.user.acl_cache['visible_categories'])
+            Category.objects.all_categories().filter(
+                id__in=request.user.acl_cache['visible_categories'],
+            )
         )
         add_categories_to_items(validated_data['top_category'], categories, [new_thread])
     else:

+ 1 - 1
misago/threads/migrations/0003_attachment_types.py

@@ -27,7 +27,7 @@ ATTACHMENTS = [
     {
         'name': 'PDF',
         'extensions': ('pdf', ),
-        'mimetypes': ('application/pdf', 'application/x-pdf', 'application/x-bzpdf', 'application/x-gzpdf'),
+        'mimetypes': ('application/pdf', 'application/x-pdf', 'application/x-bzpdf', 'application/x-gzpdf',),
         'size_limit': 4 * 1024
     },
     {

+ 2 - 2
misago/threads/search.py

@@ -47,8 +47,8 @@ class SearchThreads(SearchProvider):
 
         results = {
             'results': FeedSerializer(posts, many=True, context={
-            'user': self.request.user,
-        }).data
+                'user': self.request.user,
+            }).data
         }
         results.update(paginator)
 

+ 1 - 4
misago/users/api/userendpoints/changepassword.py

@@ -25,10 +25,7 @@ def change_password_endpoint(request, pk=None):
         )
 
         return Response({
-            'detail': _(
-                          "Password change confirmation link "
-                        "was sent to your address."
-                    )
+            'detail': _("Password change confirmation link was sent to your address.")
         })
     else:
         return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

+ 1 - 1
misago/users/djangoadmin.py

@@ -82,7 +82,7 @@ class UserAdmin(admin.ModelAdmin):
             {
                 'fields': (
                     'username', 'email', 'rank', 'last_login', 'joined_on', 'is_staff',
-                'is_superuser', 'edit_from_misago_link',
+                    'is_superuser', 'edit_from_misago_link',
                 )
             },
         ],

+ 8 - 5
misago/users/forms/admin.py

@@ -91,7 +91,9 @@ class EditUserForm(UserBaseForm):
     )
 
     new_password = forms.CharField(
-        label=_("Change password to"), widget=forms.PasswordInput, required=False
+        label=_("Change password to"),
+        widget=forms.PasswordInput,
+        required=False,
     )
 
     is_avatar_locked = YesNoSwitch(
@@ -122,7 +124,9 @@ class EditUserForm(UserBaseForm):
     )
 
     signature = forms.CharField(
-        label=_("Signature contents"), widget=forms.Textarea(attrs={'rows': 3}), required=False
+        label=_("Signature contents"),
+        widget=forms.Textarea(attrs={'rows': 3}),
+        required=False,
     )
     is_signature_locked = YesNoSwitch(
         label=_("Lock signature"),
@@ -382,9 +386,8 @@ class RankForm(forms.ModelForm):
         label=_("Give rank dedicated tab on users list"),
         required=False,
         help_text=_(
-            "Selecting this option will make users with this rank "
-            "easily discoverable by others trough dedicated page on "
-            "forum users list."
+            "Selecting this option will make users with this rank easily discoverable "
+            "by others through dedicated page on forum users list."
         )
     )
 

+ 6 - 9
misago/users/forms/auth.py

@@ -16,13 +16,11 @@ class MisagoAuthMixin(object):
         'empty_data': _("Fill out both fields."),
         'invalid_login': _("Login or password is incorrect."),
         'inactive_user': _(
-    "You have to activate your account before "
-    "you will be able to sign in."
-),
+            "You have to activate your account before you will be able to sign in."
+        ),
         'inactive_admin': _(
-            "Your account has to be activated by "
-            "Administrator before you will be able "
-            "to sign in."
+            "Your account has to be activated by Administrator "
+            "before you will be able to sign in."
         ),
     }
 
@@ -144,9 +142,8 @@ class ResetPasswordForm(GetUserForm):
             "you will be able to request new password."
         ),
         'inactive_admin': _(
-            "Administrator has to activate your account "
-            "before you will be able to request "
-            "new password."
+            "Administrator has to activate your account before "
+            "you will be able to request new password."
         ),
     }
 

+ 8 - 12
misago/users/migrations/0002_users_settings.py

@@ -103,9 +103,8 @@ def create_users_settings_group(apps, schema_editor):
                     'setting': 'default_gravatar_fallback',
                     'name': _("Fallback for default gravatar"),
                     'description': _(
-                        "Select which avatar to use when user "
-                        "has no gravatar associated with his "
-                        "e-mail address."
+                        "Select which avatar to use when user has no "
+                        "gravatar associated with his e-mail address."
                     ),
                     'value': 'dynamic',
                     'form_field': 'select',
@@ -120,9 +119,8 @@ def create_users_settings_group(apps, schema_editor):
                     'setting': 'avatar_upload_limit',
                     'name': _("Maximum size of uploaded avatar"),
                     'description': _(
-    "Enter maximum allowed file size "
-    "(in KB) for avatar uploads"
-),
+                        "Enter maximum allowed file size (in KB) for avatar uploads."
+                    ),
                     'python_type': 'int',
                     'value': 1536,
                     'field_extra': {
@@ -191,9 +189,8 @@ def create_users_settings_group(apps, schema_editor):
             'key': 'captcha',
             'name': _("CAPTCHA"),
             'description': _(
-    "Those settings allow you to combat automatic "
-    "registrations on your forum."
-),
+                "Those settings allow you to combat automatic registrations on your forum."
+            ),
             'settings': [
                 {
                     'setting': 'captcha_type',
@@ -253,9 +250,8 @@ def create_users_settings_group(apps, schema_editor):
                     'setting': 'qa_answers',
                     'name': _("Valid answers"),
                     'description': _(
-    "Enter each answer in new line. "
-    "Answers are case-insensitive."
-),
+                        "Enter each answer in new line. Answers are case-insensitive."
+                    ),
                     'value': '',
                     'form_field': 'textarea',
                     'field_extra': {

+ 4 - 6
misago/users/migrations/0006_update_settings.py

@@ -89,9 +89,8 @@ def update_users_settings(apps, schema_editor):
                     'setting': 'default_gravatar_fallback',
                     'name': _("Fallback for default gravatar"),
                     'description': _(
-                        "Select which avatar to use when user "
-                        "has no gravatar associated with his "
-                        "e-mail address."
+                        "Select which avatar to use when user has no "
+                        "gravatar associated with his e-mail address."
                     ),
                     'value': 'dynamic',
                     'form_field': 'select',
@@ -106,9 +105,8 @@ def update_users_settings(apps, schema_editor):
                     'setting': 'avatar_upload_limit',
                     'name': _("Maximum size of uploaded avatar"),
                     'description': _(
-    "Enter maximum allowed file size "
-    "(in KB) for avatar uploads"
-),
+                        "Enter maximum allowed file size (in KB) for avatar uploads."
+                    ),
                     'python_type': 'int',
                     'default_value': 1536,
                     'field_extra': {

+ 4 - 3
misago/users/views/activation.py

@@ -64,7 +64,8 @@ def activate_by_token(request, pk, token):
         return render(
             request, 'misago/activation/error.html', {
                 'message': e.args[0],
-            }, status=400
+            },
+            status=400,
         )
 
     inactive_user.requires_activation = UserModel.ACTIVATION_NONE
@@ -75,7 +76,7 @@ def activate_by_token(request, pk, token):
     return render(
         request, 'misago/activation/done.html', {
             'message': message % {
-            'user': inactive_user.username,
-        },
+                'user': inactive_user.username,
+            },
         }
     )

+ 3 - 4
misago/users/views/admin/users.py

@@ -82,9 +82,8 @@ class UsersList(UserAdmin, generic.ListView):
             'name': _("Delete all"),
             'icon': 'fa fa-eraser',
             'confirmation': _(
-                "Are you sure you want to delete selected "
-                "users? This will also delete all content "
-                "associated with their accounts."
+                "Are you sure you want to delete selected users? "
+                "This will also delete all content associated with their accounts."
             ),
             'is_atomic': False,
         },
@@ -177,7 +176,7 @@ class UsersList(UserAdmin, generic.ListView):
                         if banned_value not in banned_values:
                             ban_kwargs.update({
                                 'check_type': check_type,
-                                'banned_value': banned_value
+                                'banned_value': banned_value,
                             })
                             Ban.objects.create(**ban_kwargs)
                             banned_values.append(banned_value)

+ 2 - 2
misago/users/views/options.py

@@ -75,7 +75,7 @@ def confirm_password_change(request, token):
     return render(
         request, 'misago/options/credentials_changed.html', {
             'message': message % {
-            'user': request.user.username,
-        },
+                'user': request.user.username,
+            },
         }
     )