Permalink
Browse files

PEP8 cleanup in questions.

  • Loading branch information...
1 parent f875d60 commit a68082a7b01de5db7897dcf552fb8144d0e1c980 James Socol committed Aug 10, 2011
Showing with 85 additions and 40 deletions.
  1. +29 −8 apps/questions/forms.py
  2. +49 −29 apps/questions/question_config.py
  3. +4 −2 apps/questions/tests/test_notifications.py
  4. +3 −1 apps/questions/views.py
View
@@ -8,9 +8,19 @@
# labels and help text
SITE_AFFECTED_LABEL = _lazy(u'URL of affected site')
CRASH_ID_LABEL = _lazy(u'Crash ID(s)')
-CRASH_ID_HELP = _lazy(u"If you submit information to Mozilla when you crash, you'll be given a crash ID which uniquely identifies your crash and lets us look at details that may help identify the cause. To find your recently submitted crash IDs, go to <strong>about:crashes</strong> in your location bar. <a href='http://support.mozilla.com/en-US/kb/Firefox+crashes#Getting_the_most_accurate_help_with_your_Firefox_crash' target='_blank'>Click for detailed instructions</a>.")
+CRASH_ID_HELP = _lazy(u"If you submit information to Mozilla when you crash, "
+ u"you'll be given a crash ID which uniquely identifies "
+ u"your crash and lets us look at details that may help "
+ u"identify the cause. To find your recently submitted "
+ u"crash IDs, go to <strong>about:crashes</strong> in "
+ u"your location bar. <a href='http://support.mozilla."
+ u"com/en-US/kb/Firefox+crashes#Getting_the_most_"
+ u"accurate_help_with_your_Firefox_crash' "
+ u"target='_blank'>Click for detailed instructions</a>.")
TROUBLESHOOTING_LABEL = _lazy(u'Troubleshooting Information')
-TROUBLESHOOTING_HELP = _lazy(u'Copy and paste the information from <strong>Help &gt; Troubleshooting Information</strong>.')
+TROUBLESHOOTING_HELP = _lazy(u'Copy and paste the information from '
+ u'<strong>Help &gt; Troubleshooting '
+ u'Information</strong>.')
FREQUENCY_LABEL = _lazy(u'This happened')
FREQUENCY_CHOICES = [(u'', u''),
(u'NOT_SURE', _lazy(u'Not sure how often')),
@@ -20,24 +30,35 @@
STARTED_LABEL = _lazy(u'This started when...')
TITLE_LABEL = _lazy(u'Question')
CONTENT_LABEL = _lazy(u'Details')
-CONTENT_HELP = _lazy(u'The more information you can provide the better chance your question will be answered.')
+CONTENT_HELP = _lazy(u'The more information you can provide the better chance '
+ u'your question will be answered.')
EMAIL_LABEL = _lazy(u'Email')
-EMAIL_HELP = _lazy(u'A confirmation email will be sent to this address in order to post your question.')
+EMAIL_HELP = _lazy(u'A confirmation email will be sent to this address in '
+ u'order to post your question.')
FF_VERSION_LABEL = _lazy(u'Firefox version')
OS_LABEL = _lazy(u'Operating system')
PLUGINS_LABEL = _lazy(u'Installed plugins')
ADDON_LABEL = _lazy(u'Extension/plugin you are having trouble with')
# Validation error messages
MSG_TITLE_REQUIRED = _lazy(u'Please provide a question.')
-MSG_TITLE_SHORT = _lazy(u'Your question is too short (%(show_value)s characters). It must be at least %(limit_value)s characters.')
-MSG_TITLE_LONG = _lazy(u'Please keep the length of your question to %(limit_value)s characters or less. It is currently %(show_value)s characters.')
+MSG_TITLE_SHORT = _lazy(u'Your question is too short (%(show_value)s '
+ u'characters). It must be at least %(limit_value)s '
+ u'characters.')
+MSG_TITLE_LONG = _lazy(u'Please keep the length of your question to '
+ u'%(limit_value)s characters or less. It is currently '
+ u'%(show_value)s characters.')
MSG_CONTENT_REQUIRED = _lazy(u'Please provide content.')
-MSG_CONTENT_SHORT = _lazy(u'Your content is too short (%(show_value)s characters). It must be at least %(limit_value)s characters.')
-MSG_CONTENT_LONG = _lazy(u'Please keep the length of your content to %(limit_value)s characters or less. It is currently %(show_value)s characters.')
+MSG_CONTENT_SHORT = _lazy(u'Your content is too short (%(show_value)s '
+ u'characters). It must be at least %(limit_value)s '
+ u'characters.')
+MSG_CONTENT_LONG = _lazy(u'Please keep the length of your content to '
+ u'%(limit_value)s characters or less. It is '
+ u'currently %(show_value)s characters.')
REPLY_PLACEHOLDER = _lazy(u'Enter your reply here.')
+
class EditQuestionForm(forms.Form):
"""Form to edit an existing question"""
@@ -19,8 +19,10 @@
'articles': [
{'title': 'Errors when loading web sites',
'url': '/kb/Error%20loading%20web%20sites'},
- {'title': 'Firefox cannot load websites but other programs can',
- 'url': '/kb/Firefox+cannot+load+websites+but+other+programs+can'},
+ {'title': 'Firefox cannot load websites but other programs '
+ 'can',
+ 'url': '/kb/Firefox%20cannot%20load%20websites%20but%20other'
+ '%20programs$%20can'},
{'title': 'Web sites look wrong',
'url': '/kb/Websites%20look%20wrong'},
{'title': 'Websites say cookies are blocked',
@@ -69,7 +71,8 @@
'url': '/kb/Deleting+cookies'},
{'title': 'Enabling and disabling cookies',
'url': '/kb/Enabling+and+disabling+cookies'},
- {'title': 'The bookmarks and history system will not be functional',
+ {'title': 'The bookmarks and history system will not be '
+ 'functional',
'url': '/kb/The%20bookmarks%20and%20history%20system%20will'
'%20not%20be%20functional'},
],
@@ -78,8 +81,8 @@
('d4', {
'name': _lazy(u'Other Firefox features'),
'html': 'We have lots of helpful articles to get you started <em>'
- 'learning and using Firefox</em> and hundreds of questions '
- 'in our database. Try one of the following:',
+ 'learning and using Firefox</em> and hundreds of questions'
+ ' in our database. Try one of the following:',
'articles': [
{'title': 'How to set the home page',
'url': '/kb/How%20to%20set%20the%20home%20page'},
@@ -93,9 +96,10 @@
'url': '/kb/Pop-up%20blocker'},
{'title': 'How do I add a device to Firefox Sync?',
'url': '/kb/add-a-device-to-firefox-sync'},
- {'title': 'Firefox does not ask to save tabs and windows on exit',
- 'url': '/kb/Firefox%20does%20not%20ask%20to%20save%20tabs%20and'
- '%20windows%20on%20exit'},
+ {'title': 'Firefox does not ask to save tabs and windows on '
+ 'exit',
+ 'url': '/kb/Firefox%20does%20not%20ask%20to%20save%20tabs%20'
+ 'and%20windows%20on%20exit'},
],
'tags': ['features'],
}),
@@ -110,9 +114,11 @@
{'title': 'Plugin crash reports',
'url': '/kb/Plugin%20crash%20reports'},
{'title': 'Using the Windows Media Player plugin with Firefox',
- 'url': '/kb/Using%20the%20Windows%20Media%20Player%20plugin%20with%20Firefox'},
+ 'url': '/kb/Using%20the%20Windows%20Media%20Player%20plugin'
+ '%20with%20Firefox'},
{'title': 'Add-ons are disabled after updating Firefox',
- 'url': '/kb/Add-ons%20are%20disabled%20after%20updating%20Firefox'},
+ 'url': '/kb/Add-ons%20are%20disabled%20after%20updating%20'
+ 'Firefox'},
{'title': 'The Adobe Flash plugin has crashed',
'url': '/kb/The%20Adobe%20Flash%20plugin%20has%20crashed'},
{'title': 'Uninstalling add-ons',
@@ -134,10 +140,12 @@
{'title': 'Common questions after updating Firefox',
'url': '/kb/common-questions-after-updating-firefox'},
{'title': 'Add-ons are disabled after updating Firefox',
- 'url': '/kb/Add-ons%20are%20disabled%20after%20updating%20Firefox'},
- {'title': 'Firefox does not ask to save tabs and windows on exit',
- 'url': '/kb/Firefox%20does%20not%20ask%20to%20save%20tabs%20and%'
- '20windows%20on%20exit'},
+ 'url': '/kb/Add-ons%20are%20disabled%20after%20updating%20'
+ 'Firefox'},
+ {'title': 'Firefox does not ask to save tabs and windows on '
+ 'exit',
+ 'url': '/kb/Firefox%20does%20not%20ask%20to%20save%20tabs%20'
+ 'and%20windows%20on%20exit'},
{'title': 'Menu bar is missing',
'url': '/kb/Menu+bar+is+missing'},
],
@@ -161,9 +169,12 @@
'tags': ['mobile'],
'categories': SortedDict([
('m1', {
- 'name': _lazy(u'Problems viewing certain web sites in Firefox for Mobile'),
- 'html': 'You can try using the <a href="https://addons.mozilla.org/mobile/addon/phony/">Phony extension</a> '
- 'and setting your user agent to Android. Or try one of the following:',
+ 'name': _lazy(u'Problems viewing certain web sites in Firefox '
+ u'for Mobile'),
+ 'html': 'You can try using the <a href="https://addons.mozilla'
+ '.org/mobile/addon/phony/">Phony extension</a> '
+ 'and setting your user agent to Android. Or try one '
+ 'of the following:',
'articles': [
{'title': 'How can I use Youtube in Firefox for Mobile?',
'url': '/kb/firefox-mobile-doesnt-support-flash'},
@@ -223,7 +234,8 @@
('m5', {
'name': _lazy(u'Syncing desktop Firefox with mobile'),
'articles': [
- {'title': 'How do I sync Firefox between my desktop and mobile?',
+ {'title': 'How do I sync Firefox between my desktop and '
+ 'mobile?',
'url': '/kb/sync-firefox-between-desktop-and-mobile'},
{'title': "I've lost my phone - how do I deactivate Sync?",
'url': '/kb/ive-lost-my-phone-how-do-i-deactivate-sync'},
@@ -233,7 +245,8 @@
'tags': ['sync'],
}),
('m6', {
- 'name': _lazy(u'Another kind of problem with Firefox for mobile'),
+ 'name': _lazy(u'Another kind of problem with Firefox for '
+ u'mobile'),
'extra_fields': ['frequency'],
'html': 'We have lots of helpful articles on <em>general '
'issues with Firefox for mobile</em> and hundreds '
@@ -242,7 +255,8 @@
'articles': [
{'title': 'How to find and install add-ons',
'url': '/kb/find-and-install-add-ons'},
- {'title': 'How do I sync Firefox between my desktop and mobile?',
+ {'title': 'How do I sync Firefox between my desktop and '
+ 'mobile?',
'url': '/kb/sync-firefox-between-desktop-and-mobile'},
{'title': "Firefox for mobile doesn't support Flash",
'url': '/kb/firefox-mobile-doesnt-support-flash'},
@@ -252,8 +266,10 @@
'tags': ['other'],
}),
('m7', {
- 'name': _lazy(u'Suggestions for how to improve Firefox for mobile'),
- 'html': '<p>Please use our feedback system for suggestions for new Firefox features: '
+ 'name': _lazy(u'Suggestions for how to improve Firefox for '
+ u'mobile'),
+ 'html': '<p>Please use our feedback system for suggestions '
+ 'for new Firefox features: '
'<a href="//m.input.mozilla.com/en-US/feedback">'
'Firefox Input</a></p>',
'deadend': True,
@@ -306,7 +322,8 @@
'Firefox Sync in Firefox for mobile</em> and hundreds '
'of questions in our database. Try the following:',
'articles': [
- {'title': 'How do I sync Firefox between my desktop and mobile?',
+ {'title': 'How do I sync Firefox between my desktop and '
+ 'mobile?',
'url': '/kb/sync-firefox-between-desktop-and-mobile'},
{'title': 'How do I add a device to Firefox Sync?',
'url': '/kb/add-a-device-to-firefox-sync'},
@@ -325,20 +342,23 @@
'tags': ['iphone'],
}),
('s3', {
- 'name': _lazy(u"Setting up Firefox Sync on my Desktop Firefox"),
+ 'name': _lazy(u'Setting up Firefox Sync on my Desktop '
+ u'Firefox'),
'html': 'We have lots of helpful articles on <em>setting up '
'Firefox Sync</em> and hundreds of questions in our '
'database. Try one of the following:',
'articles': [
{'title': 'How to sync Firefox settings between computers',
- 'url': '/kb/How+to+sync+Firefox+settings+between+computers'},
+ 'url': '/kb/How%20to%20sync%20Firefox%20settings%20'
+ 'between%20computers'},
{'title': 'How do I set up Firefox Sync?',
'url': '/kb/how-do-i-set-up-firefox-sync'},
],
'tags': ['desktop'],
}),
('s4', {
- 'name': _lazy(u'Other problems syncing data between computers or devices'),
+ 'name': _lazy(u'Other problems syncing data between computers '
+ u'or devices'),
'html': 'We have lots of helpful articles on <em>Firefox sync'
'</em> and hundreds of questions in our database. Try '
'one of the following:',
@@ -359,9 +379,9 @@
('other', {
'name': _lazy(u"Thunderbird"),
'subtitle': _lazy(u"or other Mozilla products"),
- 'html': 'This site is for Firefox support. You can get help with Thunderbird and'
- ' other Mozilla products at'
- ' <a href="//www.mozilla.org/support">support.mozilla.org</a>.',
+ 'html': 'This site is for Firefox support. You can get help with '
+ 'Thunderbird and other Mozilla products at '
+ '<a href="//www.mozilla.org/support">support.mozilla.org</a>.',
'categories': SortedDict([]),
'deadend': True,
}),
@@ -148,7 +148,8 @@ def _toggle_watch_question(self, event_type, turn_on=True):
return question
@mock.patch.object(Site.objects, 'get_current')
- @mock.patch.object(settings._wrapped, 'TIDINGS_CONFIRM_ANONYMOUS_WATCHES', False)
+ @mock.patch.object(settings._wrapped, 'TIDINGS_CONFIRM_ANONYMOUS_WATCHES',
+ False)
def test_solution_notification(self, get_current):
"""Assert that hitting the watch toggle toggles and that proper mails
are sent to anonymous and registered watchers."""
@@ -176,7 +177,8 @@ def test_solution_notification(self, get_current):
self._toggle_watch_question('solution', turn_on=False)
@mock.patch.object(Site.objects, 'get_current')
- @mock.patch.object(settings._wrapped, 'TIDINGS_CONFIRM_ANONYMOUS_WATCHES', False)
+ @mock.patch.object(settings._wrapped, 'TIDINGS_CONFIRM_ANONYMOUS_WATCHES',
+ False)
def test_answer_notification(self, get_current):
"""Assert that hitting the watch toggle toggles and that proper mails
are sent to anonymous users, registered users, and the question
View
@@ -78,7 +78,9 @@ def questions(request):
question_qs = Question.objects.select_related(
'creator', 'last_answer', 'last_answer__creator')
question_qs = question_qs.extra(
- {'_num_votes': 'SELECT COUNT(*) FROM questions_questionvote WHERE questions_questionvote.question_id = questions_question.id'})
+ {'_num_votes': 'SELECT COUNT(*) FROM questions_questionvote WHERE '
+ 'questions_questionvote.question_id = '
+ 'questions_question.id'})
question_qs = question_qs.filter(creator__is_active=1)
if filter_ == 'no-replies':

0 comments on commit a68082a

Please sign in to comment.