Permalink
Browse files

More PEP8 exclusions; lots of PEP8 clean-up

  • Loading branch information...
ndarville committed Feb 10, 2013
1 parent 547f06c commit f02312b6de3c06cf68cfaa5fb4b05abd4eb66844
Showing with 39 additions and 37 deletions.
  1. +1 −1 .pep8
  2. +5 −5 _postinstall/mkplaceholders.py
  3. +9 −8 forum/forms.py
  4. +2 −1 forum/model_tests.py
  5. +12 −12 forum/views.py
  6. +10 −10 ponyforum/example_local_settings.py
View
2 .pep8
@@ -1,3 +1,3 @@
[pep8]
ignore = E122,E221,E226,E272
ignore = E122,E127,E221,E226,E241,E272,E302,E501
max-line-length = 79
@@ -86,11 +86,11 @@ def parse_manuscript(text):
global characters
speaker, content, category, characters = "", "", "", {}
categories = {
"AUTHOR": "",
"TRANSLATOR": "",
"TITLE": "",
"CHARACTERS": ""
}
"AUTHOR": "",
"TRANSLATOR": "",
"TITLE": "",
"CHARACTERS": ""
}
for line in text:
if line.rstrip() in categories:
View
@@ -17,19 +17,20 @@ class CustomEmailInput(Input):
class CustomRegistrationForm(RegistrationFormUniqueEmail):
"""Extends a django-registration form."""
attrs_dict = {
'class': 'required',
'required': 'required'
}
'class': 'required',
'required': 'required'
}
username = forms.CharField(max_length=30,
widget=forms.TextInput(
attrs=attrs_dict), # add autofocus
label=_("Username"))
email = forms.EmailField(widget=CustomEmailInput(
attrs=dict(
attrs_dict,
maxlength=75)),
label=_("E-mail"))
email = forms.EmailField(
widget=CustomEmailInput(
attrs=dict(
attrs_dict,
maxlength=75)),
label=_("E-mail"))
def clean_email(self):
"""Validate that the supplied e-mail address is unique for the
View
@@ -155,6 +155,7 @@ def test_create_report(self):
# Check the two saved fields from before
self.assertEquals(only_report_in_db.reason_short, reason)
self.assertEquals(only_report_in_db.reason_long_plain, reason+"111")
self.assertEquals(only_report_in_db.reason_long_html,
self.assertEquals(
only_report_in_db.reason_long_html,
"<p>"+reason+"111"+"</p>")
self.assertEquals(only_report_in_db.creation_date, now)
View
@@ -345,9 +345,9 @@ def post(request, post_id):
thread = post.thread
if request.user.has_perm('forum.remove_thread') or not thread.is_removed:
if not post.is_removed\
or request.user.has_perm('forum.remove_thread')\
or request.user.has_perm('forum.remove_post'):
if (not post.is_removed or
request.user.has_perm('forum.remove_thread') or
request.user.has_perm('forum.remove_post')):
return render(request, 'post.html', {'post': post, 'thread': thread})
else:
messages.info(request, "The post by %s has been removed and no longer available." % post.author)
@@ -438,12 +438,12 @@ def create(request, category_id):
text_html = sanitized_smartdown(text_plain)
try:
t = Thread.objects.create(
title_plain=title_plain, title_html=title_html,
author=user, category=category,
creation_date=now, latest_reply_date=now)
title_plain=title_plain, title_html=title_html,
author=user, category=category,
creation_date=now, latest_reply_date=now)
Post.objects.create(
thread=t, creation_date=now, author=user,
content_plain=text_plain, content_html=text_html)
thread=t, creation_date=now, author=user,
content_plain=text_plain, content_html=text_html)
t.subscriber.add(user)
except:
pass
@@ -1103,8 +1103,8 @@ def nonjs(request, action, object_id):
# Also allows the opposite action, i.e. to unlock it.
if thread.is_removed and not request.user.has_perm('forum.remove_thread'):
messages.info(request, "The has thread been removed.")
return HttpResponseRedirect(reverse('forum.views.category',
args=(thread.category_id,)))
return HttpResponseRedirect(reverse(
'forum.views.category', args=(thread.category_id,)))
if not request.user.has_perm('forum.lock_thread'):
messages.error(request,
"You do not have permission to lock and unlock threads.")
@@ -1128,8 +1128,8 @@ def nonjs(request, action, object_id):
# Also allows the opposite action, i.e. to unsticky it.
if thread.is_removed and not request.user.has_perm('forum.remove_thread'):
messages.info(request, "The has thread been removed.")
return HttpResponseRedirect(reverse('forum.views.category',
args=(thread.category_id,)))
return HttpResponseRedirect(reverse(
'forum.views.category', args=(thread.category_id,)))
if not request.user.has_perm('forum.sticky_thread'):
messages.error(request,
"You do not have permission to sticky and unsticky threads.")
@@ -92,15 +92,15 @@
### DJANGO-DEBUG-TOOLBAR
if DEBUG:
DEBUG_TOOLBAR_PANELS = (
'debug_toolbar.panels.version.VersionDebugPanel',
'debug_toolbar.panels.timer.TimerDebugPanel',
'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
'debug_toolbar.panels.headers.HeaderDebugPanel',
'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
'debug_toolbar.panels.template.TemplateDebugPanel',
'debug_toolbar.panels.sql.SQLDebugPanel',
'debug_toolbar.panels.signals.SignalDebugPanel',
'debug_toolbar.panels.logger.LoggingPanel',
# 'cache_panel.panel.CacheDebugPanel',
'debug_toolbar.panels.version.VersionDebugPanel',
'debug_toolbar.panels.timer.TimerDebugPanel',
'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
'debug_toolbar.panels.headers.HeaderDebugPanel',
'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
'debug_toolbar.panels.template.TemplateDebugPanel',
'debug_toolbar.panels.sql.SQLDebugPanel',
'debug_toolbar.panels.signals.SignalDebugPanel',
'debug_toolbar.panels.logger.LoggingPanel',
# 'cache_panel.panel.CacheDebugPanel',
)
###

0 comments on commit f02312b

Please sign in to comment.