Skip to content

Commit

Permalink
#702: further fixes in dicts fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp committed Feb 26, 2017
1 parent beae568 commit 389ed33
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 19 deletions.
7 changes: 7 additions & 0 deletions extras/fixdictsformatting.py
Expand Up @@ -83,6 +83,13 @@ def walk_dedent_tree_node(node, children, force_split_next=False):
if six.text_type(node).startswith("\n"):
if isinstance(node, Leaf):
prev = node.prev_sibling
next = node.next_sibling

if next and six.text_type(next).strip() == ':':
return # excape hatch for misidentification of single nested dict item
if six.text_type(node).strip() == '}':
return # generally yapf does good job positioning closing curlybraces

is_followup = prev and prev.type == token.STRING and node.type == token.STRING
if is_followup:
new_value = node.value
Expand Down
5 changes: 4 additions & 1 deletion misago/threads/api/threadendpoints/merge.py
Expand Up @@ -192,7 +192,10 @@ def merge_threads(request, validated_data, threads, poll):
thread.delete()

record_event(
request, new_thread, 'merged', {
request,
new_thread,
'merged',
{
'merged_thread': thread.title,
},
commit=False,
Expand Down
4 changes: 3 additions & 1 deletion misago/threads/migrations/0003_attachment_types.py
Expand Up @@ -27,7 +27,9 @@
{
'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
},
{
Expand Down
4 changes: 2 additions & 2 deletions misago/threads/search.py
Expand Up @@ -47,8 +47,8 @@ def search(self, query, page=1):

results = {
'results': FeedSerializer(posts, many=True, context={
'user': self.request.user,
}).data
'user': self.request.user,
}).data
}
results.update(paginator)

Expand Down
2 changes: 1 addition & 1 deletion misago/users/djangoadmin.py
Expand Up @@ -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',
)
},
],
Expand Down
7 changes: 2 additions & 5 deletions misago/users/forms/auth.py
Expand Up @@ -15,12 +15,9 @@ class MisagoAuthMixin(object):
error_messages = {
'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."
),
'inactive_user': _("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."
),
}

Expand Down
4 changes: 1 addition & 3 deletions misago/users/migrations/0002_users_settings.py
Expand Up @@ -118,9 +118,7 @@ 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."
),
'description': _("Enter maximum allowed file size (in KB) for avatar uploads."),
'python_type': 'int',
'value': 1536,
'field_extra': {
Expand Down
4 changes: 1 addition & 3 deletions misago/users/migrations/0006_update_settings.py
Expand Up @@ -104,9 +104,7 @@ 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."
),
'description': _("Enter maximum allowed file size (in KB) for avatar uploads."),
'python_type': 'int',
'default_value': 1536,
'field_extra': {
Expand Down
4 changes: 3 additions & 1 deletion misago/users/views/activation.py
Expand Up @@ -62,7 +62,9 @@ def activate_by_token(request, pk, token):
})
except ActivationError as e:
return render(
request, 'misago/activation/error.html', {
request,
'misago/activation/error.html',
{
'message': e.args[0],
},
status=400,
Expand Down
4 changes: 2 additions & 2 deletions misago/users/views/options.py
Expand Up @@ -55,8 +55,8 @@ def confirm_email_change(request, token):
return render(
request, 'misago/options/credentials_changed.html', {
'message': message % {
'user': request.user.username,
},
'user': request.user.username,
},
}
)

Expand Down

0 comments on commit 389ed33

Please sign in to comment.