You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/10/15 21:00:53 UTC

[06/42] allura git commit: [#7980] Fix many pep8 / pyflakes and related issues

[#7980] Fix many pep8 / pyflakes and related issues

* line length
* legit uses of has_key
* unused vars
* unused imports
* etc


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/9d39b9a7
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/9d39b9a7
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/9d39b9a7

Branch: refs/heads/hs/7919
Commit: 9d39b9a74cd64da27ec80f26fee992d6d763a07f
Parents: b79b854
Author: Dave Brondsema <da...@brondsema.net>
Authored: Wed Sep 30 09:48:31 2015 -0400
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Oct 6 10:34:02 2015 +0000

----------------------------------------------------------------------
 Allura/allura/command/__init__.py               |   5 +
 .../allura/command/create_trove_categories.py   |  66 ++++-----
 Allura/allura/controllers/__init__.py           |   8 +-
 Allura/allura/controllers/auth.py               |  12 +-
 Allura/allura/lib/helpers.py                    |  53 +++----
 Allura/allura/lib/widgets/__init__.py           |   4 +
 Allura/allura/lib/widgets/forms.py              |  40 +++--
 Allura/allura/model/__init__.py                 |  15 +-
 Allura/allura/model/repo.py                     |   5 +
 Allura/allura/model/repository.py               |  34 +++--
 Allura/allura/tests/functional/test_auth.py     | 105 +++++++------
 Allura/allura/tests/functional/test_discuss.py  |  30 ++--
 .../tests/functional/test_neighborhood.py       |  55 +++----
 Allura/allura/tests/functional/test_rest.py     |   6 +-
 .../tests/functional/test_user_profile.py       |   6 +-
 Allura/allura/tests/test_globals.py             |  34 +++--
 Allura/allura/tests/test_utils.py               |  22 +--
 Allura/allura/websetup/bootstrap.py             |  38 ++---
 Allura/setup.cfg                                |   6 +
 .../forgeactivity/tests/functional/test_rest.py |   6 +-
 .../forgeblog/tests/functional/test_rest.py     |   6 +-
 .../tests/functional/test_forum.py              |  92 ++++++------
 .../tests/functional/test_forum_admin.py        |  23 ++-
 .../tests/functional/test_rest.py               |  11 +-
 .../forgediscussion/widgets/__init__.py         |   4 +
 .../tests/functional/test_controllers.py        | 148 ++++++++-----------
 .../tests/google/test_extractor.py              |  23 ++-
 .../forgelink/tests/functional/test_rest.py     |   6 +-
 .../forgetracker/tests/functional/test_rest.py  |   6 +-
 .../forgetracker/tests/functional/test_root.py  |  77 +++++-----
 .../forgewiki/tests/functional/test_rest.py     |   6 +-
 .../forgewiki/tests/functional/test_root.py     |  23 ++-
 scripts/teamforge-import.py                     |  20 +--
 33 files changed, 499 insertions(+), 496 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/command/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/__init__.py b/Allura/allura/command/__init__.py
index 24254aa..0221b7b 100644
--- a/Allura/allura/command/__init__.py
+++ b/Allura/allura/command/__init__.py
@@ -22,3 +22,8 @@ from smtp_server import SMTPServerCommand
 from create_neighborhood import CreateNeighborhoodCommand, UpdateNeighborhoodCommand
 from create_trove_categories import CreateTroveCategoriesCommand
 from set_neighborhood_features import SetNeighborhoodFeaturesCommand
+
+__all__ = [
+    'Command', 'ShowModelsCommand', 'ReindexCommand', 'EnsureIndexCommand', 'ScriptCommand', 'SetToolAccessCommand',
+    'SMTPServerCommand', 'CreateNeighborhoodCommand', 'UpdateNeighborhoodCommand', 'CreateTroveCategoriesCommand',
+    'SetNeighborhoodFeaturesCommand']

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/command/create_trove_categories.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/create_trove_categories.py b/Allura/allura/command/create_trove_categories.py
index eba9244..288117c 100644
--- a/Allura/allura/command/create_trove_categories.py
+++ b/Allura/allura/command/create_trove_categories.py
@@ -233,7 +233,7 @@ class CreateTroveCategoriesCommand(base.Command):
                                "User Interface :: Toolkits/Libraries :: ClanLib", True))
         self.create_trove_cat(
             (516, 500, "db_group_objmap", "Project is a relational object mapper",
-             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a relational object mapper",
+             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a relational object mapper",  # nopep8
              True))
         self.create_trove_cat(
             (487, 458, "ui_ggi", "GGI", "User Interface :: Toolkits/Libraries :: GGI", True))
@@ -245,7 +245,7 @@ class CreateTroveCategoriesCommand(base.Command):
                                "User Interface :: Toolkits/Libraries :: wxWidgets", True))
         self.create_trove_cat(
             (511, 500, "db_group_mgmt", "Project is a database management tool",
-             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a database management tool",
+             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a database management tool",  # nopep8
              True))
         self.create_trove_cat(
             (479, 458, "ui_qt", "Qt", "User Interface :: Toolkits/Libraries :: Qt", True))
@@ -253,7 +253,7 @@ class CreateTroveCategoriesCommand(base.Command):
             (477, 458, "ui_gtk", "GTK+", "User Interface :: Toolkits/Libraries :: GTK+", True))
         self.create_trove_cat(
             (513, 500, "db_group_netdbms", "Project is a network-based DBMS (database system)",
-             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a network-based DBMS (database system)",
+             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a network-based DBMS (database system)",  # nopep8
              True))
         self.create_trove_cat(
             (228, 458, "newt", "Newt", "User Interface :: Toolkits/Libraries :: Newt", True))
@@ -261,7 +261,7 @@ class CreateTroveCategoriesCommand(base.Command):
                                "User Interface :: Toolkits/Libraries :: Curses/Ncurses", True))
         self.create_trove_cat(
             (515, 500, "db_group_conv", "Project is a database conversion tool",
-             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a database conversion tool",
+             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a database conversion tool",  # nopep8
              True))
         self.create_trove_cat(
             (478, 458, "ui_tk", "Tk", "User Interface :: Toolkits/Libraries :: Tk", True))
@@ -271,7 +271,7 @@ class CreateTroveCategoriesCommand(base.Command):
                                "Topic :: Communications :: Email :: Post-Office", True))
         self.create_trove_cat(
             (514, 500, "db_group_propfmt", "Project is a tool for a proprietary database file format",
-             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a tool for a proprietary database file format",
+             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a tool for a proprietary database file format",  # nopep8
              True))
         self.create_trove_cat(
             (482, 458, "ui_aalib", "AAlib", "User Interface :: Toolkits/Libraries :: AAlib", True))
@@ -279,7 +279,7 @@ class CreateTroveCategoriesCommand(base.Command):
             (484, 458, "ui_fltk", "FLTK", "User Interface :: Toolkits/Libraries :: FLTK", True))
         self.create_trove_cat(
             (512, 500, "db_group_filedbms", "Project is a file-based DBMS (database system)",
-             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a file-based DBMS (database system)",
+             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a file-based DBMS (database system)",  # nopep8
              True))
         self.create_trove_cat(
             (486, 458, "ui_plib", "Plib", "User Interface :: Toolkits/Libraries :: Plib", True))
@@ -287,7 +287,7 @@ class CreateTroveCategoriesCommand(base.Command):
             (488, 458, "ui_glide", "Glide", "User Interface :: Toolkits/Libraries :: Glide", True))
         self.create_trove_cat(
             (510, 500, "db_group_api", "Project is a database abstraction layer (API)",
-             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a database abstraction layer (API)",
+             "Database Environment :: Grouping and Descriptive Categories (DB) :: Project is a database abstraction layer (API)",  # nopep8
              True))
         self.create_trove_cat(
             (490, 458, "ui_glut", "GLUT", "User Interface :: Toolkits/Libraries :: GLUT", True))
@@ -828,14 +828,14 @@ class CreateTroveCategoriesCommand(base.Command):
             (441, 315, "ecos", "eCos", "Operating System :: Handheld/Embedded Operating Systems :: eCos", True))
         self.create_trove_cat(
             (
-            443, 315, "vxworks", "VxWorks", "Operating System :: Handheld/Embedded Operating Systems :: VxWorks", True))
+            443, 315, "vxworks", "VxWorks", "Operating System :: Handheld/Embedded Operating Systems :: VxWorks", True))  # nopep8
         self.create_trove_cat((444, 315, "symbianos", "SymbianOS",
                                "Operating System :: Handheld/Embedded Operating Systems :: SymbianOS", True))
         self.create_trove_cat(
             (442, 315, "qnx", "QNX", "Operating System :: Handheld/Embedded Operating Systems :: QNX", True))
         self.create_trove_cat(
             (
-            440, 315, "uclinux", "uClinux", "Operating System :: Handheld/Embedded Operating Systems :: uClinux", True))
+            440, 315, "uclinux", "uClinux", "Operating System :: Handheld/Embedded Operating Systems :: uClinux", True))  # nopep8
         self.create_trove_cat(
             (418, 199, "modern_oses", "Modern (Vendor-Supported) Desktop Operating Systems",
              "Operating System :: Modern (Vendor-Supported) Desktop Operating Systems", True))
@@ -871,13 +871,13 @@ class CreateTroveCategoriesCommand(base.Command):
             (634, 236, "console-platforms", "Console-based Platforms",
              "Operating System :: Other Operating Systems :: Console-based Platforms", True))
         self.create_trove_cat((637, 634, "sega-dreamcast", "Sega Dreamcast",
-                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Sega Dreamcast",
+                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Sega Dreamcast",  # nopep8
                                True))
         self.create_trove_cat((635, 634, "xbox", "Microsoft Xbox",
-                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Microsoft Xbox",
+                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Microsoft Xbox",  # nopep8
                                True))
         self.create_trove_cat((636, 634, "sony-ps2", "Sony Playstation 2",
-                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Sony Playstation 2",
+                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Sony Playstation 2",  # nopep8
                                True))
         self.create_trove_cat(
             (422, 236, "mswin_98", "Win98", "Operating System :: Other Operating Systems :: Win98", True))
@@ -923,11 +923,11 @@ class CreateTroveCategoriesCommand(base.Command):
              "Operating System :: Grouping and Descriptive Categories :: Project is OS Distribution-Specific", True))
         self.create_trove_cat(
             (449, 432, "eightbit_oses", "Classic 8-bit Operating Systems (Apple, Atari, Commodore, etc.)",
-             "Operating System :: Grouping and Descriptive Categories :: Classic 8-bit Operating Systems (Apple, Atari, Commodore, etc.)",
+             "Operating System :: Grouping and Descriptive Categories :: Classic 8-bit Operating Systems (Apple, Atari, Commodore, etc.)",  # nopep8
              True))
         self.create_trove_cat(
             (436, 432, "os_portable", "OS Portable (Source code to work with many OS platforms)",
-             "Operating System :: Grouping and Descriptive Categories :: OS Portable (Source code to work with many OS platforms)",
+             "Operating System :: Grouping and Descriptive Categories :: OS Portable (Source code to work with many OS platforms)",  # nopep8
              True))
         self.create_trove_cat(
             (438, 432, "os_projectdistro", "Project is an Operating System Distribution",
@@ -935,7 +935,7 @@ class CreateTroveCategoriesCommand(base.Command):
              True))
         self.create_trove_cat(
             (235, 432, "independent", "OS Independent (Written in an interpreted language)",
-             "Operating System :: Grouping and Descriptive Categories :: OS Independent (Written in an interpreted language)",
+             "Operating System :: Grouping and Descriptive Categories :: OS Independent (Written in an interpreted language)",  # nopep8
              True))
         self.create_trove_cat(
             (200, 432, "posix", "All POSIX (Linux/BSD/UNIX-like OSes)",
@@ -945,7 +945,7 @@ class CreateTroveCategoriesCommand(base.Command):
              "Operating System :: Grouping and Descriptive Categories :: 32-bit MS Windows (NT/2000/XP)", True))
         self.create_trove_cat(
             (202, 432, "bsd", "All BSD Platforms (FreeBSD/NetBSD/OpenBSD/Apple Mac OS X)",
-             "Operating System :: Grouping and Descriptive Categories :: All BSD Platforms (FreeBSD/NetBSD/OpenBSD/Apple Mac OS X)",
+             "Operating System :: Grouping and Descriptive Categories :: All BSD Platforms (FreeBSD/NetBSD/OpenBSD/Apple Mac OS X)",  # nopep8
              True))
         self.create_trove_cat(
             (435, 432, "mswin_all32bit", "All 32-bit MS Windows (95/98/NT/2000/XP)",
@@ -1107,7 +1107,7 @@ class CreateTroveCategoriesCommand(base.Command):
         self.create_trove_cat((57, 55, "kde", "K Desktop Environment (KDE)",
                                "Topic :: Desktop Environment :: K Desktop Environment (KDE)", True))
         self.create_trove_cat(
-            (61, 57, "themes", "Themes", "Topic :: Desktop Environment :: K Desktop Environment (KDE) :: Themes", True))
+            (61, 57, "themes", "Themes", "Topic :: Desktop Environment :: K Desktop Environment (KDE) :: Themes", True))  # nopep8
         self.create_trove_cat(
             (58, 55, "gnome", "Gnome", "Topic :: Desktop Environment :: Gnome", True))
         self.create_trove_cat((62, 55, "screensavers", "Screen Savers",
@@ -1473,7 +1473,7 @@ class CreateTroveCategoriesCommand(base.Command):
              "Operating System :: Modern (Vendor-Supported) Desktop Operating Systems :: Windows 7", True))
         self.create_trove_cat(
             (
-            728, 315, "android", "Android", "Operating System :: Handheld/Embedded Operating Systems :: Android", True))
+            728, 315, "android", "Android", "Operating System :: Handheld/Embedded Operating Systems :: Android", True))  # nopep8
         self.create_trove_cat((780, 315, "ios", "Apple iPhone",
                                "Operating System :: Handheld/Embedded Operating Systems :: Apple iPhone", True))
         self.create_trove_cat((863, 534, "architects", "Architects",
@@ -1564,7 +1564,7 @@ class CreateTroveCategoriesCommand(base.Command):
         self.create_trove_cat((673, 576, "bsm", "Business Service Management",
                                "Topic :: Office/Business :: Enterprise :: Business Service Management"))
         self.create_trove_cat((674, 673, "servicesupport", "Service Support",
-                               "Topic :: Office/Business :: Enterprise :: Business Service Management :: Service Support"))
+                               "Topic :: Office/Business :: Enterprise :: Business Service Management :: Service Support"))  # nopep8
         self.create_trove_cat(
             (675, 673, "serviceassurance", "Service Assurance",
              "Topic :: Office/Business :: Enterprise :: Business Service Management :: Service Assurance"))
@@ -1593,14 +1593,14 @@ class CreateTroveCategoriesCommand(base.Command):
              "License :: OSI-Approved Open Source :: Simple Public License 2.0"))
         self.create_trove_cat(
             (687, 673, "cmdb", "Configuration Management Database (CMDB)",
-             "Topic :: Office/Business :: Enterprise :: Business Service Management :: Configuration Management Database (CMDB)"))
+             "Topic :: Office/Business :: Enterprise :: Business Service Management :: Configuration Management Database (CMDB)"))  # nopep8
         self.create_trove_cat(
             (688, 18, "mobileapps", "Mobile", "Topic :: Mobile"))
         self.create_trove_cat((689, 315, "winmobile", "Windows Mobile",
                                "Operating System :: Handheld/Embedded Operating Systems :: Windows Mobile"))
         self.create_trove_cat(
             (690, 315, "brew", "BREW (Binary Runtime Environment for Wireless)",
-             "Operating System :: Handheld/Embedded Operating Systems :: BREW (Binary Runtime Environment for Wireless)"))
+             "Operating System :: Handheld/Embedded Operating Systems :: BREW (Binary Runtime Environment for Wireless)"))  # nopep8
         self.create_trove_cat(
             (691, 315, "j2me", "J2ME (Java Platform, Micro Edition)",
              "Operating System :: Handheld/Embedded Operating Systems :: J2ME (Java Platform, Micro Edition)"))
@@ -1658,16 +1658,16 @@ class CreateTroveCategoriesCommand(base.Command):
             (717, 160, "proglangmeta", "Project is a programming language",
              "Programming Language :: Project is a programming language"))
         self.create_trove_cat((718, 634, "msxb360", "Microsoft Xbox 360",
-                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Microsoft Xbox 360"))
+                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Microsoft Xbox 360"))  # nopep8
         self.create_trove_cat((719, 634, "nintendogc", "Nintendo GameCube",
-                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Nintendo GameCube"))
+                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Nintendo GameCube"))  # nopep8
         self.create_trove_cat((720, 634, "nintendowii", "Nintendo Wii",
-                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Nintendo Wii"))
+                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Nintendo Wii"))  # nopep8
         self.create_trove_cat((721, 634, "sonyps3", "Sony PlayStation 3",
-                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Sony PlayStation 3"))
+                               "Operating System :: Other Operating Systems :: Console-based Platforms :: Sony PlayStation 3"))  # nopep8
         self.create_trove_cat(
             (722, 634, "sonypsp", "Sony PlayStation Portable (PSP)",
-             "Operating System :: Other Operating Systems :: Console-based Platforms :: Sony PlayStation Portable (PSP)"))
+             "Operating System :: Other Operating Systems :: Console-based Platforms :: Sony PlayStation Portable (PSP)"))  # nopep8
         self.create_trove_cat(
             (723, 160, "scilab", "Scilab", "Programming Language :: Scilab"))
         self.create_trove_cat(
@@ -1685,10 +1685,10 @@ class CreateTroveCategoriesCommand(base.Command):
             (730, 274, "basque", "Basque (Euskara)", "Translations :: Basque (Euskara)"))
         self.create_trove_cat(
             (731, 14, "classpath", "GNU General Public License with Classpath exception (Classpath::License)",
-             "License :: OSI-Approved Open Source :: GNU General Public License with Classpath exception (Classpath::License)"))
+             "License :: OSI-Approved Open Source :: GNU General Public License with Classpath exception (Classpath::License)"))  # nopep8
         self.create_trove_cat(
             (732, 727, "caddcam", "Computer-aided technologies (CADD/CAM/CAE)",
-             "Topic :: Scientific/Engineering :: Mechanical and Civil Engineering :: Computer-aided technologies (CADD/CAM/CAE)"))
+             "Topic :: Scientific/Engineering :: Mechanical and Civil Engineering :: Computer-aided technologies (CADD/CAM/CAE)"))  # nopep8
         self.create_trove_cat((733, 576, "humanresources", "Human Resources",
                                "Topic :: Office/Business :: Enterprise :: Human Resources"))
         self.create_trove_cat(
@@ -1983,7 +1983,7 @@ class CreateTroveCategoriesCommand(base.Command):
         self.update_trove_cat(
             16, dict(
                 fullname="GNU Library or Lesser General Public License version 2.0 (LGPLv2)",
-                fullpath="License :: OSI-Approved Open Source :: GNU Library or Lesser General Public License version 2.0 (LGPLv2)"))
+                fullpath="License :: OSI-Approved Open Source :: GNU Library or Lesser General Public License version 2.0 (LGPLv2)"))  # nopep8
         self.update_trove_cat(
             15, dict(fullname="GNU General Public License version 2.0 (GPLv2)",
                      fullpath="License :: OSI-Approved Open Source :: GNU General Public License version 2.0 (GPLv2)"))
@@ -1995,16 +1995,16 @@ class CreateTroveCategoriesCommand(base.Command):
              "License :: Creative Commons Attribution License"))
         self.create_trove_cat(
             (869, 868, "ccaslv2", "Creative Commons Attribution ShareAlike License V2.0",
-             "License :: Creative Commons Attribution License :: Creative Commons Attribution ShareAlike License V2.0"))
+             "License :: Creative Commons Attribution License :: Creative Commons Attribution ShareAlike License V2.0"))  # nopep8
         self.create_trove_cat(
             (870, 868, "ccaslv3", "Creative Commons Attribution ShareAlike License V3.0",
-             "License :: Creative Commons Attribution License :: Creative Commons Attribution ShareAlike License V3.0"))
+             "License :: Creative Commons Attribution License :: Creative Commons Attribution ShareAlike License V3.0"))  # nopep8
         self.create_trove_cat(
             (871, 868, "ccanclv2", "Creative Commons Attribution Non-Commercial License V2.0",
-             "License :: Creative Commons Attribution License :: Creative Commons Attribution Non-Commercial License V2.0"))
+             "License :: Creative Commons Attribution License :: Creative Commons Attribution Non-Commercial License V2.0"))  # nopep8
         self.create_trove_cat(
             (680, 14, "lgplv3", "GNU Library or Lesser General Public License version 3.0 (LGPLv3)",
-             "License :: OSI-Approved Open Source :: GNU Library or Lesser General Public License version 3.0 (LGPLv3)"))
+             "License :: OSI-Approved Open Source :: GNU Library or Lesser General Public License version 3.0 (LGPLv3)"))  # nopep8
         self.create_trove_cat(
             (679, 14, "gplv3", "GNU General Public License version 3.0 (GPLv3)",
              "License :: OSI-Approved Open Source :: GNU General Public License version 3.0 (GPLv3)"))

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/controllers/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/__init__.py b/Allura/allura/controllers/__init__.py
index a69bafb..417b8ad 100644
--- a/Allura/allura/controllers/__init__.py
+++ b/Allura/allura/controllers/__init__.py
@@ -18,6 +18,10 @@
 #       under the License.
 
 """Controllers for the allura application."""
-from .discuss import DiscussionController, AppDiscussionController, ThreadController, PostController, ModerationController
-from .discuss import AppDiscussionRestController
+from .discuss import DiscussionController, AppDiscussionController, ThreadController, PostController
+from .discuss import ModerationController, AppDiscussionRestController
 from .base import BaseController, DispatchIndex
+
+__all__ = [
+    'DiscussionController', 'AppDiscussionController', 'ThreadController', 'PostController', 'ModerationController',
+    'AppDiscussionRestController', 'BaseController', 'DispatchIndex']

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index f4f03c9..e3c4d38 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -51,6 +51,7 @@ from allura.controllers import BaseController
 
 log = logging.getLogger(__name__)
 
+
 class F(object):
     login_form = LoginForm()
     password_change_form = forms.PasswordChangeForm(action='/auth/preferences/change_password')
@@ -183,20 +184,19 @@ class AuthController(BaseController):
         user_record = M.User.by_email_address(email)
         allow_non_primary_email_reset = asbool(config.get('auth.allow_non_primary_email_password_reset', True))
 
-
         if not re.match(r"[^@]+@[^@]+\.[^@]+", email):
             flash('Enter email in correct format!','error')
             redirect('/auth/forgotten_password')
 
         if not allow_non_primary_email_reset:
-            message = 'If the given email address is on record, a password reset email has been sent to the account\'s primary email address.'
+            message = 'If the given email address is on record, '\
+                      'a password reset email has been sent to the account\'s primary email address.'
             email_record = M.EmailAddress.get(email=provider.get_primary_email_address(user_record=user_record),
                                                     confirmed=True)
         else:
             message = 'A password reset email has been sent, if the given email address is on record in our system.'
             email_record = M.EmailAddress.get(email=email, confirmed=True)
 
-
         if user_record and email_record and email_record.confirmed:
             hash = h.nonce(42)
             user_record.set_tool_data('AuthPasswordReset',
@@ -459,10 +459,8 @@ class PreferencesController(BaseController):
         # not using **kw in method signature, to ensure 'admin' can't be passed in via a form submit
         kw = form_params
         addr = kw.pop('addr', None)
-        new_addr= kw.pop('new_addr', None)
+        new_addr = kw.pop('new_addr', None)
         primary_addr = kw.pop('primary_addr', None)
-        oid = kw.pop('oid', None)
-        new_oid = kw.pop('new_oid', None)
         provider = plugin.AuthenticationProvider.get(request)
         for i, (old_a, data) in enumerate(zip(user.email_addresses, addr or [])):
             obj = user.address_object(old_a)
@@ -1011,7 +1009,7 @@ class OAuthController(BaseController):
             validation_pin=h.nonce(20),
             is_bearer=True,
         )
-        access_token = M.OAuthAccessToken(
+        M.OAuthAccessToken(
             consumer_token_id=consumer_token._id,
             request_token_id=c.user._id,
             user_id=request_token.user_id,

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 68330ba..bf5a580 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -133,9 +133,11 @@ def make_safe_path_portion(ustr, relaxed=True):
     s = s.replace('--', '-')
     return s
 
+
 def escape_json(data):
     return json.dumps(data).replace('<', '\u003C')
 
+
 def monkeypatch(*objs):
     def patchem(func):
         for obj in objs:
@@ -695,9 +697,9 @@ def paging_sanitizer(limit, page, total_count, zero_based_pages=True):
     return limit, page
 
 
-def _add_inline_line_numbers_to_text(text):
+def _add_inline_line_numbers_to_text(txt):
     markup_text = '<div class="codehilite"><pre>'
-    for line_num, line in enumerate(text.splitlines(), 1):
+    for line_num, line in enumerate(txt.splitlines(), 1):
         markup_text = markup_text + \
             '<span id="l%s" class="code_block"><span class="lineno">%s</span> %s</span>' % (
                 line_num, line_num, line)
@@ -705,7 +707,7 @@ def _add_inline_line_numbers_to_text(text):
     return markup_text
 
 
-def _add_table_line_numbers_to_text(text):
+def _add_table_line_numbers_to_text(txt):
     def _prepend_whitespaces(num, max_num):
         num, max_num = str(num), str(max_num)
         diff = len(max_num) - len(num)
@@ -715,7 +717,7 @@ def _add_table_line_numbers_to_text(text):
         max_num = l + start
         return '\n'.join(map(_prepend_whitespaces, range(start, max_num), [max_num] * l))
 
-    lines = text.splitlines(True)
+    lines = txt.splitlines(True)
     linenumbers = '<td class="linenos"><div class="linenodiv"><pre>' + \
         _len_to_str_column(len(lines)) + '</pre></div></td>'
     markup_text = '<table class="codehilitetable"><tbody><tr>' + \
@@ -731,28 +733,28 @@ INLINE = 'inline'
 TABLE = 'table'
 
 
-def render_any_markup(name, text, code_mode=False, linenumbers_style=TABLE):
+def render_any_markup(name, txt, code_mode=False, linenumbers_style=TABLE):
     """
     renders markdown using allura enhacements if file is in markdown format
     renders any other markup format using the pypeline
     Returns jinja-safe text
     """
-    if text == '':
-        text = '<p><em>Empty File</em></p>'
+    if txt == '':
+        txt = '<p><em>Empty File</em></p>'
     else:
         fmt = g.pypeline_markup.can_render(name)
         if fmt == 'markdown':
-            text = g.markdown.convert(text)
+            txt = g.markdown.convert(txt)
         else:
-            text = g.pypeline_markup.render(name, text)
+            txt = g.pypeline_markup.render(name, txt)
         if not fmt:
             if code_mode and linenumbers_style == INLINE:
-                text = _add_inline_line_numbers_to_text(text)
+                txt = _add_inline_line_numbers_to_text(txt)
             elif code_mode and linenumbers_style == TABLE:
-                text = _add_table_line_numbers_to_text(text)
+                txt = _add_table_line_numbers_to_text(txt)
             else:
-                text = '<pre>%s</pre>' % text
-    return Markup(text)
+                txt = '<pre>%s</pre>' % txt
+    return Markup(txt)
 
 # copied from jinja2 dev
 # latest release, 2.6, implements this incorrectly
@@ -1053,28 +1055,28 @@ def urlopen(url, retries=3, codes=(408, 500, 502, 503, 504), timeout=None):
                 raise e
 
 
-def plain2markdown(text, preserve_multiple_spaces=False, has_html_entities=False):
+def plain2markdown(txt, preserve_multiple_spaces=False, has_html_entities=False):
     if not has_html_entities:
         # prevent &foo; and &#123; from becoming HTML entities
-        text = re_amp.sub('&amp;', text)
+        txt = re_amp.sub('&amp;', txt)
     # avoid accidental 4-space indentations creating code blocks
     if preserve_multiple_spaces:
-        text = text.replace('\t', ' ' * 4)
-        text = re_preserve_spaces.sub('&nbsp;', text)
+        txt = txt.replace('\t', ' ' * 4)
+        txt = re_preserve_spaces.sub('&nbsp;', txt)
     else:
-        text = re_leading_spaces.sub('', text)
+        txt = re_leading_spaces.sub('', txt)
     try:
         # try to use html2text for most of the escaping
         import html2text
         html2text.BODY_WIDTH = 0
-        text = html2text.escape_md_section(text, snob=True)
+        txt = html2text.escape_md_section(txt, snob=True)
     except ImportError:
         # fall back to just escaping any MD-special chars
-        text = md_chars_matcher_all.sub(r"\\\1", text)
+        txt = md_chars_matcher_all.sub(r"\\\1", txt)
     # prevent < and > from becoming tags
-    text = re_angle_bracket_open.sub('&lt;', text)
-    text = re_angle_bracket_close.sub('&gt;', text)
-    return text
+    txt = re_angle_bracket_open.sub('&lt;', txt)
+    txt = re_angle_bracket_close.sub('&gt;', txt)
+    return txt
 
 
 def iter_entry_points(group, *a, **kw):
@@ -1166,7 +1168,7 @@ def login_overlay(exceptions=None):
     """
     try:
         yield
-    except HTTPUnauthorized as e:
+    except HTTPUnauthorized:
         if exceptions:
             for exception in exceptions:
                 if request.path.rstrip('/').endswith('/%s' % exception):
@@ -1251,7 +1253,6 @@ def rate_limit(cfg_opt, artifact_count, start_date, exception=None):
     now = datetime.utcnow()
     for rate, count in rate_limits.items():
         age = now - start_date
-        age = (age.microseconds +
-                (age.seconds + age.days * 24 * 3600) * 10 ** 6) / 10 ** 6
+        age = (age.microseconds + (age.seconds + age.days * 24 * 3600) * 10 ** 6) / 10 ** 6
         if age < int(rate) and artifact_count >= count:
             raise exception()

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/lib/widgets/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/__init__.py b/Allura/allura/lib/widgets/__init__.py
index 6e13a39..9d21e37 100644
--- a/Allura/allura/lib/widgets/__init__.py
+++ b/Allura/allura/lib/widgets/__init__.py
@@ -20,3 +20,7 @@ from .subscriptions import SubscriptionForm
 from .oauth_widgets import OAuthApplicationForm, OAuthRevocationForm
 from .auth_widgets import LoginForm, ForgottenPasswordForm, DisableAccountForm
 from .vote import VoteForm
+
+__all__ = [
+    'Post', 'Thread', 'Discussion', 'SubscriptionForm', 'OAuthApplicationForm', 'OAuthRevocationForm', 'LoginForm',
+    'ForgottenPasswordForm', 'DisableAccountForm', 'VoteForm']

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/lib/widgets/forms.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index cfbad2c..5d35788 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -18,7 +18,6 @@
 import logging
 import warnings
 
-from collections import defaultdict
 from pylons import app_globals as g, tmpl_context as c
 from formencode import validators as fev
 import formencode
@@ -686,13 +685,12 @@ class SelectSubCategoryForm(ForgeForm):
     def display(self, **kw):
         categories = kw.get('categories')
 
-        self.fields['selected_category'].options = \
-            [ew.Option(py_value=el.trove_cat_id, label=el.fullname)
-             for el in categories]
-        self.fields['selected_category'].validator = \
-            validator = formencode.All(
-                V.OneOfValidator(categories),
-                fev.UnicodeString(not_empty=True))
+        self.fields['selected_category'].options = [
+            ew.Option(py_value=el.trove_cat_id, label=el.fullname) for el in categories
+        ]
+        self.fields['selected_category'].validator = formencode.All(
+            V.OneOfValidator(categories),
+            fev.UnicodeString(not_empty=True))
         return super(ForgeForm, self).display(**kw)
 
 
@@ -830,18 +828,19 @@ class NeighborhoodOverviewForm(ForgeForm):
                 empty_val = False
                 if inp['value'] is None or inp['value'] == '':
                     empty_val = True
-                display += '<tr><td class="left"><label>%(label)s</label></td>'\
-                           '<td><input type="checkbox" name="%(ctx_name)s-%(inp_name)s-def" %(def_checked)s>default</td>'\
-                           '<td class="right"><div class="%(ctx_name)s-%(inp_name)s-inp"><table class="input_inner">'\
-                           '<tr><td><input type="text" class="%(inp_type)s" name="%(ctx_name)s-%(inp_name)s" '\
-                           'value="%(inp_value)s"></td><td>%(inp_additional)s</td></tr></table></div></td></tr>\n' % {'ctx_id': ctx['id'],
-                                                                                                                      'ctx_name': ctx['name'],
-                                                                                                                      'inp_name': inp['name'],
-                                                                                                                      'inp_value': inp['value'],
-                                                                                                                      'label': inp['label'],
-                                                                                                                      'inp_type': inp['type'],
-                                                                                                                      'def_checked': 'checked="checked"' if empty_val else '',
-                                                                                                                      'inp_additional': additional_inputs}
+                display += '<tr><td class="left"><label>%(label)s</label></td>' \
+                           '<td><input type="checkbox" name="%(ctx_name)s-%(inp_name)s-def" %(def_checked)s>default</td>' \
+                           '<td class="right"><div class="%(ctx_name)s-%(inp_name)s-inp"><table class="input_inner">' \
+                           '<tr><td><input type="text" class="%(inp_type)s" name="%(ctx_name)s-%(inp_name)s" ' \
+                           'value="%(inp_value)s"></td><td>%(inp_additional)s</td></tr></table></div></td></tr>\n' % {
+                               'ctx_id': ctx['id'],
+                               'ctx_name': ctx['name'],
+                               'inp_name': inp['name'],
+                               'inp_value': inp['value'],
+                               'label': inp['label'],
+                               'inp_type': inp['type'],
+                               'def_checked': 'checked="checked"' if empty_val else '',
+                               'inp_additional': additional_inputs}
             display += '</table>'
 
             if ctx['errors'] and field.show_errors and not ignore_errors:
@@ -1105,7 +1104,6 @@ class AwardGrantForm(ForgeForm):
         self._project_select_url = kw.pop('project_select_url', '')
         super(AwardGrantForm, self).__init__(*args, **kw)
 
-
     def award_options(self):
         return [ew.Option(py_value=a.short, label=a.short) for a in self._awards]
 

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/model/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/__init__.py b/Allura/allura/model/__init__.py
index 784d1af..cb817b4 100644
--- a/Allura/allura/model/__init__.py
+++ b/Allura/allura/model/__init__.py
@@ -22,7 +22,8 @@
 from .neighborhood import Neighborhood, NeighborhoodFile
 from .project import Project, ProjectCategory, TroveCategory, ProjectFile, AppConfig
 from .index import ArtifactReference, Shortlink
-from .artifact import Artifact, MovedArtifact, Message, VersionedArtifact, Snapshot, Feed, AwardFile, Award, AwardGrant, VotableArtifact
+from .artifact import Artifact, MovedArtifact, Message, VersionedArtifact, Snapshot, Feed, AwardFile, Award, AwardGrant
+from .artifact import VotableArtifact
 from .discuss import Discussion, Thread, PostHistory, Post, DiscussionAttachment
 from .attachments import BaseAttachment
 from .auth import AuthGlobals, User, ProjectRole, EmailAddress, OldProjectRole
@@ -48,3 +49,15 @@ from . import repo_refresh
 
 from ming.orm import Mapper
 Mapper.compile_all()
+
+__all__ = [
+    'Neighborhood', 'NeighborhoodFile', 'Project', 'ProjectCategory', 'TroveCategory', 'ProjectFile', 'AppConfig',
+    'ArtifactReference', 'Shortlink', 'Artifact', 'MovedArtifact', 'Message', 'VersionedArtifact', 'Snapshot', 'Feed',
+    'AwardFile', 'Award', 'AwardGrant', 'VotableArtifact', 'Discussion', 'Thread', 'PostHistory', 'Post',
+    'DiscussionAttachment', 'BaseAttachment', 'AuthGlobals', 'User', 'ProjectRole', 'EmailAddress', 'OldProjectRole',
+    'AuditLog', 'audit_log', 'AlluraUserProperty', 'File', 'Notification', 'Mailbox', 'Repository',
+    'RepositoryImplementation', 'MergeRequest', 'GitLikeTree', 'Stats', 'OAuthToken', 'OAuthConsumerToken',
+    'OAuthRequestToken', 'OAuthAccessToken', 'MonQTask', 'Webhook', 'ACE', 'ACL', 'EVERYONE', 'ALL_PERMISSIONS',
+    'DENY_ALL', 'MarkdownCache', 'main_doc_session', 'main_orm_session', 'project_doc_session', 'project_orm_session',
+    'artifact_orm_session', 'repository_orm_session', 'task_orm_session', 'ArtifactSessionExtension', 'repository',
+    'repo_refresh', ]

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index f041116..6ba6633 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -24,3 +24,8 @@ from .repository import QSIZE, README_RE, VIEWABLE_EXTENSIONS, PYPELINE_EXTENSIO
 from .repository import CommitDoc, TreeDoc, LastCommitDoc, TreesDoc, CommitRunDoc
 from .repository import RepoObject, Commit, Tree, Blob, LastCommit
 from .repository import ModelCache
+
+__all__ = [
+    'SUser', 'SObjType', 'QSIZE', 'README_RE', 'VIEWABLE_EXTENSIONS', 'PYPELINE_EXTENSIONS',
+    'DIFF_SIMILARITY_THRESHOLD', 'CommitDoc', 'TreeDoc', 'LastCommitDoc', 'TreesDoc', 'CommitRunDoc', 'RepoObject',
+    'Commit', 'Tree', 'Blob', 'LastCommit', 'ModelCache']

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 77c3fc4..75ed2dc 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -30,7 +30,7 @@ from urlparse import urljoin
 from threading import Thread
 from Queue import Queue
 from itertools import chain
-from difflib import SequenceMatcher, unified_diff
+from difflib import SequenceMatcher
 
 import tg
 from paste.deploy.converters import asint, asbool
@@ -56,7 +56,7 @@ from .timeline import ActivityObject
 from .monq_model import MonQTask
 from .project import AppConfig
 from .session import main_doc_session
-from .session import repository_orm_session, artifact_orm_session
+from .session import repository_orm_session
 
 
 log = logging.getLogger(__name__)
@@ -78,18 +78,20 @@ SObjType = S.OneOf('blob', 'tree', 'submodule')
 # Used for when we're going to batch queries using $in
 QSIZE = 100
 BINARY_EXTENSIONS = frozenset([
-    ".3ds", ".3g2", ".3gp", ".7z", ".a", ".aac", ".adp", ".ai", ".aif", ".apk", ".ar", ".asf", ".au", ".avi",
-    ".bak", ".bin", ".bk", ".bmp", ".btif", ".bz2", ".cab", ".caf", ".cgm", ".cmx", ".cpio", ".cr2", ".dat", ".deb", ".djvu", ".dll",
-    ".dmg", ".dng", ".doc", ".docx", ".dra", ".DS_Store", ".dsk", ".dts", ".dtshd", ".dvb", ".dwg", ".dxf", ".ecelp4800",
-    ".ecelp7470", ".ecelp9600", ".egg", ".eol", ".eot", ".epub", ".exe", ".f4v", ".fbs", ".fh", ".fla", ".flac", ".fli", ".flv",
-    ".fpx", ".fst", ".fvt", ".g3", ".gif", ".gz", ".h261", ".h263", ".h264", ".ico", ".ief", ".img", ".ipa", ".iso", ".jar", ".jpeg",
-    ".jpg", ".jpgv", ".jpm", ".jxr", ".ktx", ".lvp", ".lz", ".lzma", ".lzo", ".m3u", ".m4a", ".m4v", ".mar", ".mdi", ".mid", ".mj2",
-    ".mka", ".mkv", ".mmr", ".mng", ".mov", ".movie", ".mp3", ".mp4", ".mp4a", ".mpeg", ".mpg", ".mpga", ".mxu", ".nef", ".npx", ".o",
-    ".oga", ".ogg", ".ogv", ".otf", ".pbm", ".pcx", ".pdf", ".pea", ".pgm", ".pic", ".png", ".pnm", ".ppm", ".psd", ".pya", ".pyc",
-    ".pyo", ".pyv", ".qt", ".rar", ".ras", ".raw", ".rgb", ".rip", ".rlc", ".rz", ".s3m", ".s7z", ".scpt", ".sgi", ".shar", ".sil",
-    ".smv", ".so", ".sub", ".swf", ".tar", ".tbz2", ".tga", ".tgz", ".tif", ".tiff", ".tlz", ".ts", ".ttf", ".uvh", ".uvi", ".uvm",
-    ".uvp", ".uvs", ".uvu", ".viv", ".vob", ".war", ".wav", ".wax", ".wbmp", ".wdp", ".weba", ".webm", ".webp", ".whl", ".wm", ".wma",
-    ".wmv", ".wmx", ".woff", ".woff2", ".wvx", ".xbm", ".xif", ".xm", ".xpi", ".xpm", ".xwd", ".xz", ".z", ".zip", ".zipx"
+    ".3ds", ".3g2", ".3gp", ".7z", ".a", ".aac", ".adp", ".ai", ".aif", ".apk", ".ar", ".asf", ".au", ".avi", ".bak",
+    ".bin", ".bk", ".bmp", ".btif", ".bz2", ".cab", ".caf", ".cgm", ".cmx", ".cpio", ".cr2", ".dat", ".deb", ".djvu",
+    ".dll", ".dmg", ".dng", ".doc", ".docx", ".dra", ".DS_Store", ".dsk", ".dts", ".dtshd", ".dvb", ".dwg", ".dxf",
+    ".ecelp4800", ".ecelp7470", ".ecelp9600", ".egg", ".eol", ".eot", ".epub", ".exe", ".f4v", ".fbs", ".fh", ".fla",
+    ".flac", ".fli", ".flv", ".fpx", ".fst", ".fvt", ".g3", ".gif", ".gz", ".h261", ".h263", ".h264", ".ico", ".ief",
+    ".img", ".ipa", ".iso", ".jar", ".jpeg", ".jpg", ".jpgv", ".jpm", ".jxr", ".ktx", ".lvp", ".lz", ".lzma", ".lzo",
+    ".m3u", ".m4a", ".m4v", ".mar", ".mdi", ".mid", ".mj2", ".mka", ".mkv", ".mmr", ".mng", ".mov", ".movie", ".mp3",
+    ".mp4", ".mp4a", ".mpeg", ".mpg", ".mpga", ".mxu", ".nef", ".npx", ".o", ".oga", ".ogg", ".ogv", ".otf", ".pbm",
+    ".pcx", ".pdf", ".pea", ".pgm", ".pic", ".png", ".pnm", ".ppm", ".psd", ".pya", ".pyc", ".pyo", ".pyv", ".qt",
+    ".rar", ".ras", ".raw", ".rgb", ".rip", ".rlc", ".rz", ".s3m", ".s7z", ".scpt", ".sgi", ".shar", ".sil", ".smv",
+    ".so", ".sub", ".swf", ".tar", ".tbz2", ".tga", ".tgz", ".tif", ".tiff", ".tlz", ".ts", ".ttf", ".uvh", ".uvi",
+    ".uvm", ".uvp", ".uvs", ".uvu", ".viv", ".vob", ".war", ".wav", ".wax", ".wbmp", ".wdp", ".weba", ".webm", ".webp",
+    ".whl", ".wm", ".wma", ".wmv", ".wmx", ".woff", ".woff2", ".wvx", ".xbm", ".xif", ".xm", ".xpi", ".xpm", ".xwd",
+    ".xz", ".z", ".zip", ".zipx"
 ])
 
 PYPELINE_EXTENSIONS = frozenset(utils.MARKDOWN_EXTENSIONS + ['.rst'])
@@ -895,7 +897,7 @@ class MergeRequest(VersionedArtifact, ActivityObject):
             'state': {'$in': ['busy', 'complete', 'error', 'ready']},  # needed to use index
             'task_name': 'allura.tasks.repo_tasks.merge',
             'args': [self._id],
-            'time_queue': {'$gt': datetime.utcnow() - timedelta(days=1)}, # constrain on index further
+            'time_queue': {'$gt': datetime.utcnow() - timedelta(days=1)},  # constrain on index further
         }).sort('_id', -1).limit(1).first()
         if task:
             return task.state
@@ -906,7 +908,7 @@ class MergeRequest(VersionedArtifact, ActivityObject):
             'state': {'$in': ['busy', 'complete', 'error', 'ready']},  # needed to use index
             'task_name': 'allura.tasks.repo_tasks.can_merge',
             'args': [self._id],
-            'time_queue': {'$gt': datetime.utcnow() - timedelta(days=1)}, # constrain on index further
+            'time_queue': {'$gt': datetime.utcnow() - timedelta(days=1)},  # constrain on index further
         }).sort('_id', -1).limit(1).first()
         if task:
             return task.state

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index 388be1a..5ad86ea 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -1063,7 +1063,7 @@ class TestPreferences(TestController):
                               weekday=weekday2,
                               starttime=starttime2.strftime('%H:%M'),
                               endtime=endtime2.strftime('%H:%M'),
-                            _session_id=self.app.cookies['_session_id'],
+                              _session_id=self.app.cookies['_session_id'],
                           ))
         user = M.User.query.get(username='test-admin')
         timeslot2dict = dict(week_day=weekday2,
@@ -1159,14 +1159,14 @@ class TestPreferences(TestController):
         skill_cat = M.TroveCategory.query.get(show_as_skill=True)
         level = 'low'
         comment = 'test comment'
-        result = self.app.get('/auth/user_info/skills/')
-        r = self.app.post('/auth/user_info/skills/save_skill',
-                          params=dict(
-                              level=level,
-                              comment=comment,
-                              selected_skill=str(skill_cat.trove_cat_id),
-                              _session_id=self.app.cookies['_session_id'],
-                          ))
+        self.app.get('/auth/user_info/skills/')
+        self.app.post('/auth/user_info/skills/save_skill',
+                      params=dict(
+                          level=level,
+                          comment=comment,
+                          selected_skill=str(skill_cat.trove_cat_id),
+                          _session_id=self.app.cookies['_session_id'],
+                      ))
         user = M.User.query.get(username='test-admin')
         skilldict = dict(category_id=skill_cat._id,
                          comment=comment, level=level)
@@ -1175,14 +1175,14 @@ class TestPreferences(TestController):
         # Add again the same skill
         level = 'medium'
         comment = 'test comment 2'
-        result = self.app.get('/auth/user_info/skills/')
-        r = self.app.post('/auth/user_info/skills/save_skill',
-                          params=dict(
-                              level=level,
-                              comment=comment,
-                              selected_skill=str(skill_cat.trove_cat_id),
-                              _session_id=self.app.cookies['_session_id'],
-                          ))
+        self.app.get('/auth/user_info/skills/')
+        self.app.post('/auth/user_info/skills/save_skill',
+                      params=dict(
+                          level=level,
+                          comment=comment,
+                          selected_skill=str(skill_cat.trove_cat_id),
+                          _session_id=self.app.cookies['_session_id'],
+                      ))
         user = M.User.query.get(username='test-admin')
         skilldict = dict(category_id=skill_cat._id,
                          comment=comment, level=level)
@@ -1191,13 +1191,13 @@ class TestPreferences(TestController):
         # Add an invalid skill
         level2 = 'not a level'
         comment2 = 'test comment 2'
-        r = self.app.post('/auth/user_info/skills/save_skill',
-                          params=dict(
-                              level=level2,
-                              comment=comment2,
-                              selected_skill=str(skill_cat.trove_cat_id),
-                              _session_id=self.app.cookies['_session_id'],
-                          ))
+        self.app.post('/auth/user_info/skills/save_skill',
+                      params=dict(
+                          level=level2,
+                          comment=comment2,
+                          selected_skill=str(skill_cat.trove_cat_id),
+                          _session_id=self.app.cookies['_session_id'],
+                      ))
         user = M.User.query.get(username='test-admin')
         # Check that everything is as it was before
         assert len(user.skills) == 1 and skilldict in user.skills
@@ -1450,13 +1450,13 @@ class TestOAuth(TestController):
     def test_interactive(self, Request, Server):
         M.OAuthConsumerToken.consumer = mock.Mock()
         user = M.User.by_username('test-admin')
-        consumer_token = M.OAuthConsumerToken(
+        M.OAuthConsumerToken(
             api_key='api_key',
             user_id=user._id,
             description='ctok_desc',
         )
         ThreadLocalORMSession.flush_all()
-        req = Request.from_request.return_value = {
+        Request.from_request.return_value = {
             'oauth_consumer_key': 'api_key',
             'oauth_callback': 'http://my.domain.com/callback',
         }
@@ -1467,7 +1467,7 @@ class TestOAuth(TestController):
         r = r.forms[0].submit('yes')
         assert r.location.startswith('http://my.domain.com/callback')
         pin = parse_qs(urlparse(r.location).query)['oauth_verifier'][0]
-        req = Request.from_request.return_value = {
+        Request.from_request.return_value = {
             'oauth_consumer_key': 'api_key',
             'oauth_token': rtok,
             'oauth_verifier': pin,
@@ -1502,10 +1502,10 @@ class TestOAuth(TestController):
     @mock.patch('allura.controllers.rest.oauth.Server')
     @mock.patch('allura.controllers.rest.oauth.Request')
     def test_request_token_no_consumer_token(self, Request, Server):
-        req = Request.from_request.return_value = {
+        Request.from_request.return_value = {
             'oauth_consumer_key': 'api_key'}
-        r = self.app.post('/rest/oauth/request_token',
-                          params={'key': 'value'}, status=403)
+        self.app.post('/rest/oauth/request_token',
+                      params={'key': 'value'}, status=403)
 
     @mock.patch('allura.controllers.rest.oauth.Server')
     @mock.patch('allura.controllers.rest.oauth.Request')
@@ -1513,12 +1513,12 @@ class TestOAuth(TestController):
         Server().verify_request.side_effect = ValueError
         M.OAuthConsumerToken.consumer = mock.Mock()
         user = M.User.by_username('test-user')
-        consumer_token = M.OAuthConsumerToken(
+        M.OAuthConsumerToken(
             api_key='api_key',
             user_id=user._id,
         )
         ThreadLocalORMSession.flush_all()
-        req = Request.from_request.return_value = {'oauth_consumer_key': 'api_key'}
+        Request.from_request.return_value = {'oauth_consumer_key': 'api_key'}
         self.app.post('/rest/oauth/request_token', params={'key': 'value'}, status=403)
 
     def test_authorize_ok(self):
@@ -1528,7 +1528,7 @@ class TestOAuth(TestController):
             user_id=user._id,
             description='ctok_desc',
         )
-        rtok = M.OAuthRequestToken(
+        M.OAuthRequestToken(
             api_key='api_key',
             consumer_token_id=ctok._id,
             callback='oob',
@@ -1549,7 +1549,7 @@ class TestOAuth(TestController):
             user_id=user._id,
             description='ctok_desc',
         )
-        rtok = M.OAuthRequestToken(
+        M.OAuthRequestToken(
             api_key='api_key',
             consumer_token_id=ctok._id,
             callback='oob',
@@ -1567,7 +1567,7 @@ class TestOAuth(TestController):
             user_id=user._id,
             description='ctok_desc',
         )
-        rtok = M.OAuthRequestToken(
+        M.OAuthRequestToken(
             api_key='api_key',
             consumer_token_id=ctok._id,
             callback='oob',
@@ -1584,7 +1584,7 @@ class TestOAuth(TestController):
             user_id=user._id,
             description='ctok_desc',
         )
-        rtok = M.OAuthRequestToken(
+        M.OAuthRequestToken(
             api_key='api_key',
             consumer_token_id=ctok._id,
             callback='http://my.domain.com/callback',
@@ -1601,7 +1601,7 @@ class TestOAuth(TestController):
             user_id=user._id,
             description='ctok_desc',
         )
-        rtok = M.OAuthRequestToken(
+        M.OAuthRequestToken(
             api_key='api_key',
             consumer_token_id=ctok._id,
             callback='http://my.domain.com/callback?myparam=foo',
@@ -1613,7 +1613,7 @@ class TestOAuth(TestController):
 
     @mock.patch('allura.controllers.rest.oauth.Request')
     def test_access_token_no_consumer(self, Request):
-        req = Request.from_request.return_value = {
+        Request.from_request.return_value = {
             'oauth_consumer_key': 'api_key',
             'oauth_token': 'api_key',
             'oauth_verifier': 'good',
@@ -1622,13 +1622,13 @@ class TestOAuth(TestController):
 
     @mock.patch('allura.controllers.rest.oauth.Request')
     def test_access_token_no_request(self, Request):
-        req = Request.from_request.return_value = {
+        Request.from_request.return_value = {
             'oauth_consumer_key': 'api_key',
             'oauth_token': 'api_key',
             'oauth_verifier': 'good',
         }
         user = M.User.by_username('test-admin')
-        ctok = M.OAuthConsumerToken(
+        M.OAuthConsumerToken(
             api_key='api_key',
             user_id=user._id,
             description='ctok_desc',
@@ -1638,7 +1638,7 @@ class TestOAuth(TestController):
 
     @mock.patch('allura.controllers.rest.oauth.Request')
     def test_access_token_bad_pin(self, Request):
-        req = Request.from_request.return_value = {
+        Request.from_request.return_value = {
             'oauth_consumer_key': 'api_key',
             'oauth_token': 'api_key',
             'oauth_verifier': 'bad',
@@ -1649,7 +1649,7 @@ class TestOAuth(TestController):
             user_id=user._id,
             description='ctok_desc',
         )
-        rtok = M.OAuthRequestToken(
+        M.OAuthRequestToken(
             api_key='api_key',
             consumer_token_id=ctok._id,
             callback='http://my.domain.com/callback?myparam=foo',
@@ -1662,7 +1662,7 @@ class TestOAuth(TestController):
     @mock.patch('allura.controllers.rest.oauth.Server')
     @mock.patch('allura.controllers.rest.oauth.Request')
     def test_access_token_bad_sig(self, Request, Server):
-        req = Request.from_request.return_value = {
+        Request.from_request.return_value = {
             'oauth_consumer_key': 'api_key',
             'oauth_token': 'api_key',
             'oauth_verifier': 'good',
@@ -1673,7 +1673,7 @@ class TestOAuth(TestController):
             user_id=user._id,
             description='ctok_desc',
         )
-        rtok = M.OAuthRequestToken(
+        M.OAuthRequestToken(
             api_key='api_key',
             consumer_token_id=ctok._id,
             callback='http://my.domain.com/callback?myparam=foo',
@@ -1687,7 +1687,7 @@ class TestOAuth(TestController):
     @mock.patch('allura.controllers.rest.oauth.Server')
     @mock.patch('allura.controllers.rest.oauth.Request')
     def test_access_token_ok(self, Request, Server):
-        req = Request.from_request.return_value = {
+        Request.from_request.return_value = {
             'oauth_consumer_key': 'api_key',
             'oauth_token': 'api_key',
             'oauth_verifier': 'good',
@@ -1698,7 +1698,7 @@ class TestOAuth(TestController):
             user_id=user._id,
             description='ctok_desc',
         )
-        rtok = M.OAuthRequestToken(
+        M.OAuthRequestToken(
             api_key='api_key',
             consumer_token_id=ctok._id,
             callback='http://my.domain.com/callback?myparam=foo',
@@ -1735,8 +1735,8 @@ class TestDisableAccount(TestController):
 
     def test_bad_password(self):
         self.app.get('/')  # establish session
-        r = self.app.post('/auth/disable/do_disable',{'password': 'bad',
-                                                      '_session_id': self.app.cookies['_session_id'],})
+        r = self.app.post('/auth/disable/do_disable', {'password': 'bad',
+                                                       '_session_id': self.app.cookies['_session_id'], })
         assert_in('Invalid password', r)
         user = M.User.by_username('test-admin')
         assert_equal(user.disabled, False)
@@ -1744,7 +1744,7 @@ class TestDisableAccount(TestController):
     def test_disable(self):
         self.app.get('/')  # establish session
         r = self.app.post('/auth/disable/do_disable', {'password': 'foo',
-                                                       '_session_id': self.app.cookies['_session_id'],})
+                                                       '_session_id': self.app.cookies['_session_id'], })
         assert_equal(r.status_int, 302)
         assert_equal(r.location, 'http://localhost/')
         flash = json.loads(self.webflash(r))
@@ -1866,8 +1866,8 @@ class TestPasswordExpire(TestController):
             self.assert_redirects()
             user = M.User.by_username('test-user')
             user.set_tool_data('AuthPasswordReset',
-                          hash="generated_hash_value",
-                          hash_expiry="04-08-2020")
+                               hash="generated_hash_value",
+                               hash_expiry="04-08-2020")
             hash = user.get_tool_data('AuthPasswordReset', 'hash')
             hash_expiry = user.get_tool_data('AuthPasswordReset', 'hash_expiry')
             assert_equal(hash, 'generated_hash_value')
@@ -1890,7 +1890,6 @@ class TestPasswordExpire(TestController):
             assert_equal(hash, '')
             assert_equal(hash_expiry, '')
 
-
     def check_validation(self, oldpw, pw, pw2):
         user = M.User.by_username('test-user')
         old_update_time = user.last_password_updated
@@ -1950,7 +1949,6 @@ class TestPasswordExpire(TestController):
 
 
 class TestCSRFProtection(TestController):
-
     def test_blocks_invalid(self):
         # so test-admin isn't automatically logged in for all requests
         self.app.extra_environ = {'disable_auth_magic': 'True'}
@@ -1980,4 +1978,3 @@ class TestCSRFProtection(TestController):
     def test_token_present_on_first_request(self):
         r = self.app.get('/auth/')
         assert_true(r.form['_session_id'].value)
-

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/tests/functional/test_discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_discuss.py b/Allura/allura/tests/functional/test_discuss.py
index 21b5d3b..f5e5b05 100644
--- a/Allura/allura/tests/functional/test_discuss.py
+++ b/Allura/allura/tests/functional/test_discuss.py
@@ -69,9 +69,8 @@ class TestDiscuss(TestDiscussBase):
         params = dict()
         inputs = f.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key(
-                    'value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[f.find('textarea')['name']] = text
         r = self.app.post(f['action'].encode('utf-8'), params=params,
                           headers={'Referer': thread_link.encode("utf-8")},
@@ -92,9 +91,8 @@ class TestDiscuss(TestDiscussBase):
         params = dict()
         inputs = post_form.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key(
-                    'value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[post_form.find('textarea')['name']] = 'This is a new post'
         r = self.app.post(post_link,
                           params=params,
@@ -107,9 +105,8 @@ class TestDiscuss(TestDiscussBase):
         params = dict()
         inputs = post_form.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key(
-                    'value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[post_form.find('textarea')['name']] = 'Tis a reply'
         r = self.app.post(post_link + 'reply',
                           params=params,
@@ -214,9 +211,8 @@ class TestDiscuss(TestDiscussBase):
         params = dict()
         inputs = reply_form.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key(
-                    'value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[reply_form.find('textarea')['name']] = 'zzz'
         self.app.post(post_link, params)
         assert create_activity.call_count == 1, create_activity.call_count
@@ -252,9 +248,8 @@ class TestAttachment(TestDiscussBase):
         params = dict()
         inputs = f.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key(
-                    'value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[f.find('textarea')['name']] = 'Test Post'
         r = self.app.post(f['action'].encode('utf-8'), params=params,
                           headers={'Referer': self.thread_link.encode('utf-8')})
@@ -292,9 +287,8 @@ class TestAttachment(TestDiscussBase):
         inputs = post_form.findAll('input')
 
         for field in inputs:
-            if field.has_key('name') and (field['name'] != 'file_info'):
-                params[field['name']] = field.has_key(
-                    'value') and field['value'] or ''
+            if field.has_key('name') and field['name'] != 'file_info':  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[post_form.find('textarea')['name']] = 'Reply'
         r = self.app.post(self.post_link + 'reply',
                           params=params,

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index 9b8b215..13c2808 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -38,7 +38,6 @@ from alluratest.controller import setup_trove_categories
 
 
 class TestNeighborhood(TestController):
-
     def test_home_project(self):
         r = self.app.get('/adobe/wiki/')
         assert r.location.endswith('/adobe/wiki/Home/')
@@ -120,9 +119,9 @@ class TestNeighborhood(TestController):
 
     def test_prohibited_tools(self):
         self.app.post('/p/_admin/update',
-                          params=dict(name='Projects',
-                          prohibited_tools='wiki, tickets'),
-                          extra_environ=dict(username='root'))
+                      params=dict(name='Projects',
+                                  prohibited_tools='wiki, tickets'),
+                      extra_environ=dict(username='root'))
 
         r = self.app.get('/p/_admin/overview', extra_environ=dict(username='root'))
         assert 'wiki, tickets' in r
@@ -133,7 +132,7 @@ class TestNeighborhood(TestController):
 
         r = self.app.post('/p/_admin/update',
                           params=dict(name='Projects',
-                          prohibited_tools='wiki, test'),
+                                      prohibited_tools='wiki, test'),
                           extra_environ=dict(username='root'))
         assert 'error' in self.webflash(r), self.webflash(r)
 
@@ -361,8 +360,8 @@ class TestNeighborhood(TestController):
         assert '/*projecttitlecolor*/.project_title{color:green;}' in neighborhood.css
         assert '/*barontop*/.pad h2.colored {background-color:#555555; background-image: none;}' in neighborhood.css
         assert '/*titlebarbackground*/.pad h2.title{background-color:#333; background-image: none;}' in neighborhood.css
-        assert "/*titlebarcolor*/.pad h2.title, .pad h2.title small a {color:#444;} "\
-               ".pad h2.dark small b.ico {background-image: "\
+        assert "/*titlebarcolor*/.pad h2.title, .pad h2.title small a {color:#444;} " \
+               ".pad h2.dark small b.ico {background-image: " \
                "url('/nf/_ew_/theme/allura/images/neo-icon-set-ffffff-256x350.png');}" in neighborhood.css
 
     def test_max_projects(self):
@@ -647,8 +646,8 @@ class TestNeighborhood(TestController):
     def test_project_template(self):
         setup_trove_categories()
         icon_url = 'file://' + \
-            os.path.join(allura.__path__[0], 'nf', 'allura',
-                         'images', 'neo-icon-set-454545-256x350.png')
+                   os.path.join(allura.__path__[0], 'nf', 'allura',
+                                'images', 'neo-icon-set-454545-256x350.png')
         test_groups = [{
             "name": "Viewer",  # group will be created, all params are valid
             "permissions": ["read"],
@@ -670,7 +669,9 @@ class TestNeighborhood(TestController):
             "permissions": ["admin"]
         }]
         r = self.app.post('/adobe/_admin/update', params=dict(name='Mozq1',
-                                                              css='', homepage='# MozQ1!\n[Root]', project_template="""{
+                                                              css='',
+                                                              homepage='# MozQ1!\n[Root]',
+                                                              project_template="""{
                 "private":true,
                 "icon":{
                     "url":"%s",
@@ -717,22 +718,14 @@ class TestNeighborhood(TestController):
         p = M.Project.query.get(shortname='testtemp')
         # make sure the correct tools got installed in the right order
         top_nav = r.html.find('div', {'id': 'top_nav'})
-        assert top_nav.contents[1].contents[1].contents[
-            1]['href'] == '/adobe/testtemp/wiki/'
-        assert 'Wiki' in top_nav.contents[
-            1].contents[1].contents[1].contents[0]
-        assert top_nav.contents[1].contents[3].contents[
-            1]['href'] == '/adobe/testtemp/discussion/'
-        assert 'Discussion' in top_nav.contents[
-            1].contents[3].contents[1].contents[0]
-        assert top_nav.contents[1].contents[5].contents[
-            1]['href'] == '/adobe/testtemp/news/'
-        assert 'News' in top_nav.contents[
-            1].contents[5].contents[1].contents[0]
-        assert top_nav.contents[1].contents[7].contents[
-            1]['href'] == '/adobe/testtemp/admin/'
-        assert 'Admin' in top_nav.contents[
-            1].contents[7].contents[1].contents[0]
+        assert top_nav.contents[1].contents[1].contents[1]['href'] == '/adobe/testtemp/wiki/'
+        assert 'Wiki' in top_nav.contents[1].contents[1].contents[1].contents[0]
+        assert top_nav.contents[1].contents[3].contents[1]['href'] == '/adobe/testtemp/discussion/'
+        assert 'Discussion' in top_nav.contents[1].contents[3].contents[1].contents[0]
+        assert top_nav.contents[1].contents[5].contents[1]['href'] == '/adobe/testtemp/news/'
+        assert 'News' in top_nav.contents[1].contents[5].contents[1].contents[0]
+        assert top_nav.contents[1].contents[7].contents[1]['href'] == '/adobe/testtemp/admin/'
+        assert 'Admin' in top_nav.contents[1].contents[7].contents[1].contents[0]
         # make sure project is private
         r = self.app.get(
             '/adobe/testtemp/wiki/',
@@ -804,7 +797,7 @@ class TestNeighborhood(TestController):
                 },
                 "tool_order":["wiki","admin"],
 
-                }""" ),
+                }"""),
                           extra_environ=dict(username='root'))
         neighborhood = M.Neighborhood.query.get(name='Adobe')
         neighborhood.anchored_tools = 'wiki:Wiki'
@@ -835,7 +828,8 @@ class TestNeighborhood(TestController):
             r = self.app.get(
                 '/p/check_names?neighborhood=Projects&project_unixname=%s' % name)
             assert_equal(
-                r.json, {'project_unixname': 'Please use only small letters, numbers, and dashes 3-15 characters long.'})
+                r.json,
+                {'project_unixname': 'Please use only small letters, numbers, and dashes 3-15 characters long.'})
         r = self.app.get(
             '/p/check_names?neighborhood=Projects&project_unixname=mymoz')
         assert_equal(r.json, {})
@@ -895,8 +889,8 @@ class TestNeighborhood(TestController):
         image = PIL.Image.open(StringIO(r.body))
         assert image.size == (48, 48)
         self.app.post('/adobe/_admin/awards/grant',
-                params=dict(grant='FOO', recipient='adobe-1',
-                            url='http://award.org', comment='Winner!'),
+                      params=dict(grant='FOO', recipient='adobe-1',
+                                  url='http://award.org', comment='Winner!'),
                       extra_environ=dict(username='root'))
         r = self.app.get('/adobe/_admin/accolades',
                          extra_environ=dict(username='root'))
@@ -960,7 +954,6 @@ class TestNeighborhood(TestController):
 
 
 class TestPhoneVerificationOnProjectRegistration(TestController):
-
     def test_phone_verification_fragment_renders(self):
         self.app.get('/p/phone_verification_fragment', status=200)
         self.app.get('/adobe/phone_verification_fragment', status=200)

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_rest.py b/Allura/allura/tests/functional/test_rest.py
index 903cda7..1a2006d 100644
--- a/Allura/allura/tests/functional/test_rest.py
+++ b/Allura/allura/tests/functional/test_rest.py
@@ -249,9 +249,9 @@ class TestRestHome(TestRestApiBase):
         assert_equal(r.json['result'], False)
 
     def test_project_has_access_no_params(self):
-        r = self.api_get('/rest/p/test/has_access', status=404)
-        r = self.api_get('/rest/p/test/has_access?user=root', status=404)
-        r = self.api_get('/rest/p/test/has_access?perm=read', status=404)
+        self.api_get('/rest/p/test/has_access', status=404)
+        self.api_get('/rest/p/test/has_access?user=root', status=404)
+        self.api_get('/rest/p/test/has_access?perm=read', status=404)
 
     def test_project_has_access_unknown_params(self):
         """Unknown user and/or permission always False for has_access API"""

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/tests/functional/test_user_profile.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_user_profile.py b/Allura/allura/tests/functional/test_user_profile.py
index 4425ace..14c28bf 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -194,9 +194,9 @@ class TestUserProfileHasAccessAPI(TestRestApiBase):
 
     @td.with_user_project('test-admin')
     def test_has_access_no_params(self):
-        r = self.api_get('/rest/u/test-admin/profile/has_access', status=404)
-        r = self.api_get('/rest/u/test-admin/profile/has_access?user=root', status=404)
-        r = self.api_get('/rest/u/test-admin/profile/has_access?perm=read', status=404)
+        self.api_get('/rest/u/test-admin/profile/has_access', status=404)
+        self.api_get('/rest/u/test-admin/profile/has_access?user=root', status=404)
+        self.api_get('/rest/u/test-admin/profile/has_access?perm=read', status=404)
 
     @td.with_user_project('test-admin')
     def test_has_access_unknown_params(self):

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 0203969..bb5d80e 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -48,6 +48,7 @@ from allura.tests import decorators as td
 from forgewiki import model as WM
 from forgeblog import model as BM
 
+
 def squish_spaces(text):
     return re.sub(r'\s+', ' ', text)
 
@@ -171,7 +172,9 @@ def test_macro_gittip_button():
     with h.push_config(c, project=p_test):
         r = g.markdown_wiki.convert('[[gittip_button username=test]]')
     assert_equal(
-        r, u'<div class="markdown_content"><p><iframe height="22pt" src="https://www.gittip.com/test/widget.html" style="border: 0; margin: 0; padding: 0;" width="48pt"></iframe>\n</p></div>')
+        r,
+        u'<div class="markdown_content"><p><iframe height="22pt" src="https://www.gittip.com/test/widget.html" '
+        u'style="border: 0; margin: 0; padding: 0;" width="48pt"></iframe>\n</p></div>')
 
 
 def test_macro_neighborhood_feeds():
@@ -213,7 +216,7 @@ def test_macro_members():
     p_test.add_user(M.User.by_username('test-user'), ['Developer'])
     p_test.add_user(M.User.by_username('test-user-0'), ['Member'])
     ThreadLocalORMSession.flush_all()
-    r = g.markdown_wiki.convert('[[members limit=2]]').replace('\t','').replace('\n','')
+    r = g.markdown_wiki.convert('[[members limit=2]]').replace('\t', '').replace('\n', '')
     assert_equal(r,
                  '<div class="markdown_content"><h6>Project Members:</h6>'
                  '<ul class="md-users-list">'
@@ -258,7 +261,7 @@ def test_macro_project_admins_one_br():
     with h.push_config(c, project=p_test):
         r = g.markdown_wiki.convert('[[project_admins]]\n[[download_button]]')
 
-    assert not '</a><br/><br/><a href=' in r, r
+    assert '</a><br/><br/><a href=' not in r, r
     assert '</a></li><li><a href=' in r, r
 
 
@@ -293,6 +296,7 @@ def test_macro_include_no_extra_br():
 <p></p></div>'''
     assert_equal(squish_spaces(html), squish_spaces(expected_html))
 
+
 @with_setup(setUp, tearDown)
 @td.with_wiki
 @td.with_tool('test', 'Wiki', 'wiki2')
@@ -330,11 +334,13 @@ def test_macro_include_permissions():
 @patch('oembed.OEmbedEndpoint.fetch')
 def test_macro_embed(oembed_fetch):
     oembed_fetch.return_value = {
-        "html": '<iframe width="480" height="270" src="http://www.youtube.com/embed/kOLpSPEA72U?feature=oembed" frameborder="0" allowfullscreen></iframe>)',
+        "html": '<iframe width="480" height="270" src="http://www.youtube.com/embed/kOLpSPEA72U?feature=oembed" '
+                'frameborder="0" allowfullscreen></iframe>)',
         "title": "Nature's 3D Printer: MIND BLOWING Cocoon in Rainforest - Smarter Every Day 94",
     }
     r = g.markdown_wiki.convert('[[embed url=http://www.youtube.com/watch?v=kOLpSPEA72U]]')
-    assert_in('<div class="grid-20"><iframe height="270" src="https://www.youtube.com/embed/kOLpSPEA72U?feature=oembed" width="480"></iframe></div>',
+    assert_in('<div class="grid-20"><iframe height="270" '
+              'src="https://www.youtube.com/embed/kOLpSPEA72U?feature=oembed" width="480"></iframe></div>',
               r.replace('\n', ''))
 
 
@@ -484,13 +490,20 @@ def test_markdown_invalid_tagslash():
     r = g.markdown.convert('<div/onload><img src=x onerror=alert(document.cookie)>')
     assert_not_in('onerror', r)
 
+
 def test_markdown_invalid_script_in_link():
     r = g.markdown.convert('[xss](http://"><a onmouseover=prompt(document.domain)>xss</a>)')
-    assert_equal('''<div class="markdown_content"><p><a class="" href='http://"&gt;&lt;a%20onmouseover=prompt(document.domain)&gt;xss&lt;/a&gt;' rel="nofollow">xss</a></p></div>''', r)
+    assert_equal('<div class="markdown_content"><p><a class="" '
+                 '''href='http://"&gt;&lt;a%20onmouseover=prompt(document.domain)&gt;xss&lt;/a&gt;' '''
+                 'rel="nofollow">xss</a></p></div>', r)
+
 
 def test_markdown_invalid_script_in_link2():
     r = g.markdown.convert('[xss](http://"><img src=x onerror=alert(document.cookie)>)')
-    assert_equal('''<div class="markdown_content"><p><a class="" href='http://"&gt;&lt;img%20src=x%20onerror=alert(document.cookie)&gt;' rel="nofollow">xss</a></p></div>''', r)
+    assert_equal('<div class="markdown_content"><p><a class="" '
+                 '''href='http://"&gt;&lt;img%20src=x%20onerror=alert(document.cookie)&gt;' '''
+                 'rel="nofollow">xss</a></p></div>', r)
+
 
 @td.with_wiki
 def test_macro_include():
@@ -629,7 +642,8 @@ def test_hideawards_macro():
 
     with h.push_context(p_nbhd.neighborhood_project._id):
         r = g.markdown_wiki.convert('[[projects]]')
-        assert_in('<div class="feature"> <a href="http://award.org" rel="nofollow" title="Winner!">Award short</a> </div>',
+        assert_in('<div class="feature"> <a href="http://award.org" rel="nofollow" title="Winner!">'
+                  'Award short</a> </div>',
                   squish_spaces(r))
 
         r = g.markdown_wiki.convert('[[projects show_awards_banner=False]]')
@@ -642,7 +656,7 @@ def get_project_names(r):
     """
     # projects short names are in h2 elements without any attributes
     # there is one more h2 element, but it has `class` attribute
-    #re_proj_names = re.compile('<h2><a[^>]>(.+)<\/a><\/h2>')
+    # re_proj_names = re.compile('<h2><a[^>]>(.+)<\/a><\/h2>')
     re_proj_names = re.compile('<h2><a[^>]+>(.+)<\/a><\/h2>')
     return [e for e in re_proj_names.findall(r)]
 
@@ -754,8 +768,10 @@ class TestHandlePaging(unittest.TestCase):
     def setUp(self):
         prefs = {}
         c.user = Mock()
+
         def get_pref(name):
             return prefs.get(name)
+
         def set_pref(name, value):
             prefs[name] = value
         c.user.get_pref = get_pref

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/tests/test_utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_utils.py b/Allura/allura/tests/test_utils.py
index dd67ded..413165a 100644
--- a/Allura/allura/tests/test_utils.py
+++ b/Allura/allura/tests/test_utils.py
@@ -22,7 +22,6 @@ import time
 import unittest
 import datetime as dt
 from ming.odm import session
-import model as M
 from os import path
 
 from webob import Request
@@ -169,12 +168,12 @@ class TestTruthyCallable(unittest.TestCase):
             return utils.TruthyCallable(predicate)
         true_predicate = wrapper_func(True)
         false_predicate = wrapper_func(False)
-        assert true_predicate(True) == True
-        assert false_predicate(False) == False
-        assert true_predicate() == True
-        assert false_predicate() == False
-        assert bool(true_predicate) == True
-        assert bool(false_predicate) == False
+        assert true_predicate(True) is True
+        assert false_predicate(False) is False
+        assert true_predicate() is True
+        assert false_predicate() is False
+        assert bool(true_predicate) is True
+        assert bool(false_predicate) is False
 
 
 class TestCaseInsensitiveDict(unittest.TestCase):
@@ -260,7 +259,8 @@ class TestHTMLSanitizer(unittest.TestCase):
         assert_equal(self.simple_tag_list(p), ['div', 'div'])
 
     def test_html_sanitizer_youtube_iframe(self):
-        p = utils.ForgeHTMLSanitizer('<div><iframe src="https://www.youtube.com/embed/kOLpSPEA72U?feature=oembed"></iframe></div>')
+        p = utils.ForgeHTMLSanitizer(
+            '<div><iframe src="https://www.youtube.com/embed/kOLpSPEA72U?feature=oembed"></iframe></div>')
         assert_equal(
             self.simple_tag_list(p), ['div', 'iframe', 'div'])
 
@@ -272,6 +272,7 @@ def test_ip_address():
     assert_equal(utils.ip_address(req),
                  '1.2.3.4')
 
+
 def test_ip_address_header():
     req = Mock()
     req.remote_addr = '1.2.3.4'
@@ -280,6 +281,7 @@ def test_ip_address_header():
         assert_equal(utils.ip_address(req),
                      '5.6.7.8')
 
+
 def test_ip_address_header_not_set():
     req = Mock()
     req.remote_addr = '1.2.3.4'
@@ -329,5 +331,5 @@ def test_phone_number_hash():
 
 def test_skip_mod_date():
     with utils.skip_mod_date(M.Artifact):
-        assert getattr(session(M.Artifact)._get(), 'skip_mod_date', None) == True
-    assert getattr(session(M.Artifact)._get(), 'skip_mod_date', None) == False
\ No newline at end of file
+        assert getattr(session(M.Artifact)._get(), 'skip_mod_date', None) is True
+    assert getattr(session(M.Artifact)._get(), 'skip_mod_date', None) is False

http://git-wip-us.apache.org/repos/asf/allura/blob/9d39b9a7/Allura/allura/websetup/bootstrap.py
----------------------------------------------------------------------
diff --git a/Allura/allura/websetup/bootstrap.py b/Allura/allura/websetup/bootstrap.py
index 33a3f3c..8bc04fe 100644
--- a/Allura/allura/websetup/bootstrap.py
+++ b/Allura/allura/websetup/bootstrap.py
@@ -22,7 +22,6 @@ import os
 import sys
 import logging
 import shutil
-from collections import defaultdict
 from textwrap import dedent
 
 import tg
@@ -110,7 +109,7 @@ def bootstrap(command, conf, vars):
     log.info('Initializing search')
 
     log.info('Registering root user & default neighborhoods')
-    anonymous = M.User(
+    M.User(
         _id=None,
         username='*anonymous',
         display_name='Anonymous')
@@ -172,7 +171,8 @@ def bootstrap(command, conf, vars):
         [[projects show_total=yes]]
         '''))
     set_nbhd_wiki_content(p_users, dedent('''
-        This is the "Users" neighborhood.  All users automatically get a user-project created for them, using their username.
+        This is the "Users" neighborhood.
+        All users automatically get a user-project created for them, using their username.
 
         [Neighborhood administration](/u/admin)
 
@@ -208,19 +208,19 @@ def bootstrap(command, conf, vars):
             make_user('Test User %d' % unum)
 
     log.info('Creating basic project categories')
-    cat1 = M.ProjectCategory(name='clustering', label='Clustering')
+    M.ProjectCategory(name='clustering', label='Clustering')
     cat2 = M.ProjectCategory(name='communications', label='Communications')
-    cat2_1 = M.ProjectCategory(
+    M.ProjectCategory(
         name='synchronization', label='Synchronization', parent_id=cat2._id)
-    cat2_2 = M.ProjectCategory(
+    M.ProjectCategory(
         name='streaming', label='Streaming', parent_id=cat2._id)
-    cat2_3 = M.ProjectCategory(name='fax', label='Fax', parent_id=cat2._id)
-    cat2_4 = M.ProjectCategory(name='bbs', label='BBS', parent_id=cat2._id)
+    M.ProjectCategory(name='fax', label='Fax', parent_id=cat2._id)
+    M.ProjectCategory(name='bbs', label='BBS', parent_id=cat2._id)
 
     cat3 = M.ProjectCategory(name='database', label='Database')
-    cat3_1 = M.ProjectCategory(
+    M.ProjectCategory(
         name='front_ends', label='Front-Ends', parent_id=cat3._id)
-    cat3_2 = M.ProjectCategory(
+    M.ProjectCategory(
         name='engines_servers', label='Engines/Servers', parent_id=cat3._id)
 
     if create_test_data:
@@ -244,12 +244,12 @@ def bootstrap(command, conf, vars):
             p_projects.add_user(u_admin, ['Admin'])
             p_users.add_user(u_admin, ['Admin'])
 
-            p_allura = n_projects.register_project('allura', u_admin, 'Allura')
-        u1 = make_user('Test User')
-        p_adobe1 = n_adobe.register_project('adobe-1', u_admin, 'Adobe project 1')
+            n_projects.register_project('allura', u_admin, 'Allura')
+        make_user('Test User')
+        n_adobe.register_project('adobe-1', u_admin, 'Adobe project 1')
         p_adobe.add_user(u_admin, ['Admin'])
         p0 = n_projects.register_project('test', u_admin, 'Test Project')
-        p1 = n_projects.register_project('test2', u_admin, 'Test 2')
+        n_projects.register_project('test2', u_admin, 'Test 2')
         p0._extra_tool_status = ['alpha', 'beta']
 
     sess = session(M.Neighborhood)  # all the sessions are the same
@@ -279,11 +279,11 @@ def bootstrap(command, conf, vars):
             log.info('Registering initial apps')
             with h.push_config(c, user=u_admin):
                 p0.install_apps([{'ep_name': ep_name}
-                    for ep_name, app in g.entry_points['tool'].iteritems()
-                    if app._installable(tool_name=ep_name,
-                                        nbhd=n_projects,
-                                        project_tools=[])
-                ])
+                                 for ep_name, app in g.entry_points['tool'].iteritems()
+                                 if app._installable(tool_name=ep_name,
+                                                     nbhd=n_projects,
+                                                     project_tools=[])
+                                 ])
 
     ThreadLocalORMSession.flush_all()
     ThreadLocalORMSession.close_all()