Skip to content

Commit 4b96061

Browse files
committed
E123
1 parent ad61471 commit 4b96061

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+378
-255
lines changed

docs/releases/1.9.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ Notable features and improvements
5353
and 1.10.3 respectively. Custom confirmation boxes have been removed
5454
and standard ones are used instead now.
5555

56+
* The diff between 1.8 and 1.9 is large -- most of it because of coding style
57+
cleanups. `flake8 <https://pypi.python.org/pypi/flake8>`_ runs should not
58+
show any warnings. The only error code we'll ignore for some time is
59+
``E128``.
60+
5661

5762
Bugfixes
5863
========

example/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ class CategoryAdmin(tree_editor.TreeEditor):
1010
list_filter = ('parent',)
1111
prepopulated_fields = {
1212
'slug': ('name',),
13-
}
13+
}
1414

1515
admin.site.register(Category, CategoryAdmin)

example/models.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
'regions': (
2525
('main', 'Main region'),
2626
('sidebar', 'Sidebar', 'inherited'),
27-
),
28-
})
27+
),
28+
})
2929
Page.create_content_type(RawContent)
3030
Page.create_content_type(MediaFileContent, TYPE_CHOICES=(
3131
('default', 'Default position'),
32-
))
32+
))
3333
Page.create_content_type(ImageContent, POSITION_CHOICES=(
3434
('default', 'Default position'),
35-
))
35+
))
3636

3737

3838
def get_admin_fields(form, *args, **kwargs):
@@ -43,25 +43,25 @@ def get_admin_fields(form, *args, **kwargs):
4343
initial=form.instance.parameters.get('exclusive_subpages', False),
4444
help_text=_('Exclude everything other than the application\'s'
4545
' content when rendering subpages.'),
46-
),
46+
),
4747
}
4848

4949

5050
Page.create_content_type(ApplicationContent, APPLICATIONS=(
5151
('blog_urls', 'Blog', {
5252
'admin_fields': get_admin_fields,
5353
'urls': 'example.blog_urls',
54-
}),
55-
))
54+
}),
55+
))
5656

5757

5858
Entry.register_regions(
5959
('main', 'Main region'),
60-
)
60+
)
6161
Entry.create_content_type(RawContent)
6262
Entry.create_content_type(ImageContent, POSITION_CHOICES=(
6363
('default', 'Default position'),
64-
))
64+
))
6565

6666

6767
class BlogEntriesNavigationExtension(NavigationExtension):
@@ -79,12 +79,12 @@ def children(self, page, **kwargs):
7979
url=app_reverse(
8080
'blog_entry_detail', 'blog_urls', kwargs={'pk': entry.id}),
8181
level=page.level + 1,
82-
)
82+
)
8383

8484
Page.register_extensions(
8585
'feincms.module.page.extensions.navigation',
8686
'feincms.module.page.extensions.sites',
87-
)
87+
)
8888

8989

9090
@python_2_unicode_compatible

feincms/admin/filterspecs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self, f, request, params, model, model_admin,
3636
self.lookup_choices = [(
3737
pk,
3838
"%s%s" % ("&nbsp;" * level, shorten_string(title, max_length=25)),
39-
) for pk, title, level in parents]
39+
) for pk, title, level in parents]
4040

4141
def choices(self, cl):
4242
yield {

feincms/admin/item_editor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def get_feincms_inlines(self, model, request):
103103
attrs = {
104104
'__module__': model.__module__,
105105
'model': content_type,
106-
}
106+
}
107107

108108
if hasattr(content_type, 'feincms_item_editor_inline'):
109109
inline = content_type.feincms_item_editor_inline
@@ -176,7 +176,7 @@ def _frontend_editing_view(self, request, cms_id, content_type,
176176
'identifier': obj.fe_identifier(),
177177
'FEINCMS_JQUERY_NO_CONFLICT':
178178
settings.FEINCMS_JQUERY_NO_CONFLICT,
179-
}, context_instance=template.RequestContext(request))
179+
}, context_instance=template.RequestContext(request))
180180
else:
181181
form = ModelForm(instance=obj, prefix=content_type)
182182

@@ -188,7 +188,7 @@ def _frontend_editing_view(self, request, cms_id, content_type,
188188
'form': form,
189189
'is_popup': True,
190190
'media': self.media,
191-
})
191+
})
192192

193193
return render_to_response('admin/feincms/fe_editor.html', context,
194194
context_instance=template.RequestContext(request))
@@ -217,7 +217,7 @@ def get_extra_context(self, request):
217217

218218
'FEINCMS_FRONTEND_EDITING': settings.FEINCMS_FRONTEND_EDITING,
219219
'FEINCMS_POPUP_VAR': is_popup_var(),
220-
}
220+
}
221221

222222
for processor in self.model.feincms_item_editor_context_processors:
223223
extra_context.update(processor(request))
@@ -317,7 +317,7 @@ def get_template_list(self):
317317
opts.app_label, opts.object_name.lower()),
318318
'admin/feincms/%s/item_editor.html' % opts.app_label,
319319
'admin/feincms/item_editor.html',
320-
]
320+
]
321321

322322
def get_fieldsets(self, request, obj=None):
323323
"""

feincms/admin/tree_editor.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def ajax_editable_boolean_cell(item, attr, text='', override=None):
114114
item.pk,
115115
attr,
116116
'checked="checked"' if value else '',
117-
)]
117+
)]
118118

119119
a.insert(0, '<div id="wrap_%s_%d">' % (attr, item.pk))
120120
a.append('</div>')
@@ -239,7 +239,7 @@ def __init__(self, *args, **kwargs):
239239
opts.app_label, opts.object_name.lower()),
240240
'admin/feincms/%s/tree_editor.html' % opts.app_label,
241241
'admin/feincms/tree_editor.html',
242-
]
242+
]
243243
self.object_change_permission =\
244244
opts.app_label + '.' + opts.get_change_permission()
245245
self.object_add_permission =\
@@ -388,9 +388,9 @@ def _toggle_boolean(self, request):
388388
# Weed out unchanged cells to keep the updates small. This assumes
389389
# that the order a possible get_descendents() returns does not change
390390
# before and after toggling this attribute. Unlikely, but still...
391-
return HttpResponse(json.dumps(
392-
[b for a, b in zip(before_data, data) if a != b]
393-
), content_type="application/json")
391+
return HttpResponse(
392+
json.dumps([b for a, b in zip(before_data, data) if a != b]),
393+
content_type="application/json")
394394

395395
def get_changelist(self, request, **kwargs):
396396
return ChangeList
@@ -531,9 +531,7 @@ def delete_selected_tree(self, modeladmin, request, queryset):
531531
"Denied delete request by \"%s\" for object #%s",
532532
request.user, obj.id)
533533
self.message_user(request,
534-
_("Successfully deleted %(count)d items.") % {
535-
"count": n
536-
})
534+
_("Successfully deleted %(count)d items.") % {"count": n})
537535
# Return None to display the change list page again
538536
return None
539537
else:

feincms/content/application/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,15 +370,15 @@ def closest_match(cls, urlconf_path):
370370
contents = cls.objects.filter(
371371
parent__in=page_class.objects.active(),
372372
urlconf_path=urlconf_path,
373-
).order_by('pk').select_related('parent')
373+
).order_by('pk').select_related('parent')
374374

375375
if len(contents) > 1:
376376
try:
377377
current = short_language_code(get_language())
378378
return [
379379
content for content in contents if
380380
short_language_code(content.parent.language) == current
381-
][0]
381+
][0]
382382

383383
except (AttributeError, IndexError):
384384
pass

feincms/content/comments/models.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self, *args, **kwargs):
5757
else _('not public')),
5858
'app': comments_model._meta.app_label,
5959
'model': comments_model._meta.module_name,
60-
}
60+
}
6161
f.help_text = r
6262

6363
cls.feincms_item_editor_form = CommentContentAdminForm
@@ -91,17 +91,19 @@ def process(self, request, **kwargs):
9191
if f is None:
9292
f = comments.get_form()(comment_page)
9393

94-
self.rendered_output = render_to_string([
95-
'content/comments/%s.html' % parent_type,
96-
'content/comments/default-site.html',
97-
'content/comments/default.html',
94+
self.rendered_output = render_to_string(
95+
[
96+
'content/comments/%s.html' % parent_type,
97+
'content/comments/default-site.html',
98+
'content/comments/default.html',
9899
],
99100
RequestContext(request, {
100101
'content': self,
101102
'feincms_page': self.parent,
102103
'parent': comment_page,
103104
'form': f,
104-
}))
105+
}),
106+
)
105107

106108
def render(self, **kwargs):
107109
return getattr(self, 'rendered_output', u'')

feincms/content/contactform/models.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ def process(self, request, **kwargs):
5454
form.cleaned_data['subject'],
5555
render_to_string('content/contactform/email.txt', {
5656
'data': form.cleaned_data,
57-
}),
57+
}),
5858
form.cleaned_data['email'],
5959
[self.email],
60-
fail_silently=True)
60+
fail_silently=True,
61+
)
6162

6263
return HttpResponseRedirect('?_cf_thanks=1')
6364
else:
@@ -72,7 +73,8 @@ def process(self, request, **kwargs):
7273
'content/contactform/form.html', {
7374
'content': self,
7475
'form': form,
75-
}, context_instance=RequestContext(request))
76+
},
77+
context_instance=RequestContext(request))
7678

7779
def render(self, **kwargs):
7880
return getattr(self, 'rendered_output', u'')

feincms/content/file/models.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ class Meta:
2727
verbose_name_plural = _('files')
2828

2929
def render(self, **kwargs):
30-
return render_to_string([
31-
'content/file/%s.html' % self.region,
32-
'content/file/default.html',
33-
], {'content': self}, context_instance=kwargs.get('context'))
30+
return render_to_string(
31+
[
32+
'content/file/%s.html' % self.region,
33+
'content/file/default.html',
34+
],
35+
{'content': self},
36+
context_instance=kwargs.get('context'),
37+
)

0 commit comments

Comments
 (0)