You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2014/01/10 22:22:59 UTC

[03/36] PEP8 cleanup

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/ForgeWiki/forgewiki/scripts/wiki_from_trac/wiki_from_trac.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/scripts/wiki_from_trac/wiki_from_trac.py b/ForgeWiki/forgewiki/scripts/wiki_from_trac/wiki_from_trac.py
index 65630aa..afc6f41 100644
--- a/ForgeWiki/forgewiki/scripts/wiki_from_trac/wiki_from_trac.py
+++ b/ForgeWiki/forgewiki/scripts/wiki_from_trac/wiki_from_trac.py
@@ -30,25 +30,38 @@ log = logging.getLogger(__name__)
 
 
 class WikiFromTrac(ScriptTask):
+
     """Import Trac Wiki to Allura Wiki"""
     @classmethod
     def parser(cls):
         parser = argparse.ArgumentParser(description='Import wiki from'
-            'Trac to allura wiki')
+                                         'Trac to allura wiki')
 
         parser.add_argument('trac_url', type=str, help='Trac URL')
-        parser.add_argument('-a', '--api-ticket', dest='api_key', help='API ticket')
-        parser.add_argument('-s', '--secret-key', dest='secret_key', help='Secret key')
-        parser.add_argument('-p', '--project', dest='project', help='Project to import to')
-        parser.add_argument('-t', '--tracker', dest='tracker', help='Tracker to import to')
-        parser.add_argument('-f', '--forum', dest='forum', help='Forum tool to import to')
-        parser.add_argument('-w', '--wiki', dest='wiki', help='Wiki tool to import to')
-        parser.add_argument('-u', '--base-url', dest='base_url', default='https://sourceforge.net', help='Base Allura (%(default)s for default)')
-        parser.add_argument('-o', dest='import_opts', default=[], action='append', help='Specify import option(s)', metavar='opt=val')
-        parser.add_argument('--user-map', dest='user_map_file', help='Map original users to SF.net users', metavar='JSON_FILE')
-        parser.add_argument('--validate', dest='validate', action='store_true', help='Validate import data')
-        parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help='Verbose operation')
-        parser.add_argument('-c', '--continue', dest='cont', action='store_true', help='Continue import into existing tracker')
+        parser.add_argument('-a', '--api-ticket',
+                            dest='api_key', help='API ticket')
+        parser.add_argument('-s', '--secret-key',
+                            dest='secret_key', help='Secret key')
+        parser.add_argument('-p', '--project', dest='project',
+                            help='Project to import to')
+        parser.add_argument('-t', '--tracker', dest='tracker',
+                            help='Tracker to import to')
+        parser.add_argument('-f', '--forum', dest='forum',
+                            help='Forum tool to import to')
+        parser.add_argument('-w', '--wiki', dest='wiki',
+                            help='Wiki tool to import to')
+        parser.add_argument('-u', '--base-url', dest='base_url',
+                            default='https://sourceforge.net', help='Base Allura (%(default)s for default)')
+        parser.add_argument('-o', dest='import_opts',
+                            default=[], action='append', help='Specify import option(s)', metavar='opt=val')
+        parser.add_argument('--user-map', dest='user_map_file',
+                            help='Map original users to SF.net users', metavar='JSON_FILE')
+        parser.add_argument('--validate', dest='validate',
+                            action='store_true', help='Validate import data')
+        parser.add_argument('-v', '--verbose', dest='verbose',
+                            action='store_true', help='Verbose operation')
+        parser.add_argument('-c', '--continue', dest='cont',
+                            action='store_true', help='Continue import into existing tracker')
         parser.add_argument('-C', '--converter', dest='converter',
                             default='html2text',
                             help='Converter to use on wiki text. '

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/ForgeWiki/forgewiki/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_rest.py b/ForgeWiki/forgewiki/tests/functional/test_rest.py
index 2b5cfd5..560503e 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_rest.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_rest.py
@@ -42,13 +42,18 @@ class TestWikiApi(TestRestApiBase):
         r = self.app.get('/p/test/wiki/Home/')
         discussion_url = r.html.findAll('form')[2]['action'][:-4]
         content = file(__file__).read()
-        self.app.post('/wiki/Home/attach', upload_files=[('file_info', 'test_root.py', content)])
+        self.app.post('/wiki/Home/attach',
+                      upload_files=[('file_info', 'test_root.py', content)])
         r = self.app.get('/rest/p/test/wiki/Home/')
         r = json.loads(r.body)
-        assert_equal(r['attachments'][0]['url'], 'http://localhost/p/test/wiki/Home/attachment/test_root.py')
-        assert_equal(r['discussion_thread_url'], 'http://localhost/rest%s' % discussion_url)
-        assert_equal(r['discussion_thread']['_id'], discussion_url.split('/')[-2])
-        self.app.post('/wiki/Home/attach', upload_files=[('file_info', '__init__.py', content),])
+        assert_equal(r['attachments'][0]['url'],
+                     'http://localhost/p/test/wiki/Home/attachment/test_root.py')
+        assert_equal(r['discussion_thread_url'], 'http://localhost/rest%s' %
+                     discussion_url)
+        assert_equal(r['discussion_thread']['_id'],
+                     discussion_url.split('/')[-2])
+        self.app.post('/wiki/Home/attach',
+                      upload_files=[('file_info', '__init__.py', content), ])
         r = self.app.get('/rest/p/test/wiki/Home/')
         r = json.loads(r.body)
         assert_equal(len(r['attachments']), 2)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/ForgeWiki/forgewiki/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 0bd5d78..5b05aad 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -42,7 +42,9 @@ from forgewiki import model
 # CommentController methods exposed:
 #     reply, delete
 
+
 class TestRootController(TestController):
+
     def setUp(self):
         super(TestRootController, self).setUp()
         self.setup_with_tools()
@@ -57,7 +59,7 @@ class TestRootController(TestController):
         assert 'Create Page' in r
         # No 'Create Page' button if user doesn't have 'create' perm
         r = self.app.get('/wiki/tést/',
-                extra_environ=dict(username='*anonymous')).follow()
+                         extra_environ=dict(username='*anonymous')).follow()
         assert 'Create Page' not in r
 
     def test_root_markdown_syntax(self):
@@ -88,8 +90,10 @@ class TestRootController(TestController):
     @patch('allura.lib.search.search')
     def test_search(self, search):
         r = self.app.get('/wiki/search?q=test')
-        assert_in('<a href="/wiki/search?q=test&amp;sort=score+asc" class="strong">relevance</a>', r)
-        assert_in('<a href="/wiki/search?q=test&amp;sort=mod_date_dt+desc" class="">date</a>', r)
+        assert_in(
+            '<a href="/wiki/search?q=test&amp;sort=score+asc" class="strong">relevance</a>', r)
+        assert_in(
+            '<a href="/wiki/search?q=test&amp;sort=mod_date_dt+desc" class="">date</a>', r)
 
         p = M.Project.query.get(shortname='test')
         r = self.app.get('/wiki/search?q=test&sort=score+asc')
@@ -102,7 +106,7 @@ class TestRootController(TestController):
             'qf': 'title^2 text',
             'pf': 'title^2 text',
             'fq': [
-                'project_id_s:%s'  % p._id,
+                'project_id_s:%s' % p._id,
                 'mount_point_s:wiki',
                 '-deleted_b:true',
                 'type_s:("WikiPage" OR "WikiPage Snapshot")',
@@ -115,8 +119,10 @@ class TestRootController(TestController):
         }
         search.assert_called_with('test', **solr_query)
 
-        r = self.app.get('/wiki/search?q=test&search_comments=on&history=on&sort=mod_date_dt+desc')
-        solr_query['fq'][3] = 'type_s:("WikiPage" OR "WikiPage Snapshot" OR "Post")'
+        r = self.app.get(
+            '/wiki/search?q=test&search_comments=on&history=on&sort=mod_date_dt+desc')
+        solr_query['fq'][
+            3] = 'type_s:("WikiPage" OR "WikiPage Snapshot" OR "Post")'
         solr_query['fq'].remove('is_history_b:False')
         solr_query['sort'] = 'mod_date_dt desc'
         search.assert_called_with('test', **solr_query)
@@ -169,10 +175,10 @@ class TestRootController(TestController):
         response = self.app.post(
             '/wiki/foo-bar/update',
             params={
-                'title':'foo/bar',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'}).follow()
+                'title': 'foo/bar',
+                'text': 'sometext',
+                'labels': '',
+                'viewable_by-0.id': 'all'}).follow()
         assert 'foo-bar' in response
         assert 'foo-bar' in response.request.url
 
@@ -180,10 +186,10 @@ class TestRootController(TestController):
         r = self.app.post(
             '/wiki/page.dot/update',
             params={
-                'title':'page.dot',
-                'text':'text1',
-                'labels':'',
-                'viewable_by-0.id':'all'}).follow()
+                'title': 'page.dot',
+                'text': 'text1',
+                'labels': '',
+                'viewable_by-0.id': 'all'}).follow()
         assert 'page.dot' in r
 
     def test_subpage_attempt(self):
@@ -191,10 +197,10 @@ class TestRootController(TestController):
         self.app.post(
             '/wiki/tést/update',
             params={
-                'title':'tést',
-                'text':'text1',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+                'title': 'tést',
+                'text': 'text1',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
         assert '/p/test/wiki/Home/' in self.app.get('/wiki/tést/Home/')
         self.app.get('/wiki/tést/notthere/', status=404)
 
@@ -203,41 +209,42 @@ class TestRootController(TestController):
         self.app.post(
             '/wiki/tést/update',
             params={
-                'title':'tést',
-                'text':'text1',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+                'title': 'tést',
+                'text': 'text1',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
         self.app.post(
             '/wiki/tést/update',
             params={
-                'title':'tést',
-                'text':'text2',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+                'title': 'tést',
+                'text': 'text2',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
         response = self.app.get('/wiki/tést/history')
         assert 'tést' in response
         # two revisions are shown
         assert '2 by Test Admin' in response
         assert '1 by Test Admin' in response
         # you can revert to an old revison, but not the current one
-        assert response.html.find('a',{'href':'./revert?version=1'})
-        assert not response.html.find('a',{'href':'./revert?version=2'})
-        response = self.app.get('/wiki/tést/history', extra_environ=dict(username='*anonymous'))
+        assert response.html.find('a', {'href': './revert?version=1'})
+        assert not response.html.find('a', {'href': './revert?version=2'})
+        response = self.app.get('/wiki/tést/history',
+                                extra_environ=dict(username='*anonymous'))
         # two revisions are shown
         assert '2 by Test Admin' in response
         assert '1 by Test Admin' in response
         # you cannot revert to any revision
-        assert not response.html.find('a',{'href':'./revert?version=1'})
-        assert not response.html.find('a',{'href':'./revert?version=2'})
+        assert not response.html.find('a', {'href': './revert?version=1'})
+        assert not response.html.find('a', {'href': './revert?version=2'})
 
     def test_page_diff(self):
         self.app.post(
             '/wiki/tést/update',
             params={
-                'title':'tést',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+                'title': 'tést',
+                'text': 'sometext',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
         self.app.post('/wiki/tést/revert', params=dict(version='1'))
         response = self.app.get('/wiki/tést/')
         assert 'Subscribe' in response
@@ -322,10 +329,10 @@ class TestRootController(TestController):
         self.app.post(
             '/wiki/TEST/update',
             params={
-                'title':'TEST',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+                'title': 'TEST',
+                'text': 'sometext',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
         response = self.app.get('/wiki/TEST/raw')
         assert 'TEST' in response
 
@@ -333,10 +340,10 @@ class TestRootController(TestController):
         self.app.post(
             '/wiki/tést/update',
             params={
-                'title':'tést',
-                'text':'',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+                'title': 'tést',
+                'text': '',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
         response = self.app.post('/wiki/tést/revert', params=dict(version='1'))
         assert '.' in response.json['location']
         response = self.app.get('/wiki/tést/')
@@ -347,10 +354,10 @@ class TestRootController(TestController):
         self.app.post(
             '/wiki/tést/update',
             params={
-                'title':'tést',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+                'title': 'tést',
+                'text': 'sometext',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
         response = self.app.post('/wiki/tést/revert', params=dict(version='1'))
         assert '.' in response.json['location']
         response = self.app.get('/wiki/tést/')
@@ -362,10 +369,10 @@ class TestRootController(TestController):
         response = self.app.post(
             '/wiki/tést/update',
             params={
-                'title':'tést',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+                'title': 'tést',
+                'text': 'sometext',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
         assert_equal(spam_checker.check.call_args[0][0], 'sometext')
         assert 'tést' in response
 
@@ -374,18 +381,18 @@ class TestRootController(TestController):
         response = self.app.post(
             '/wiki/tést/update',
             params={
-                'title':'tést',
-                'text':'sometext',
-                'labels':'yellow,green',
-                'viewable_by-0.id':'all'})
+                'title': 'tést',
+                'text': 'sometext',
+                'labels': 'yellow,green',
+                'viewable_by-0.id': 'all'})
         assert 'tést' in response
         response = self.app.post(
             '/wiki/tést/update',
             params={
-                'title':'tést',
-                'text':'sometext',
-                'labels':'yellow',
-                'viewable_by-0.id':'all'})
+                'title': 'tést',
+                'text': 'sometext',
+                'labels': 'yellow',
+                'viewable_by-0.id': 'all'})
         assert 'tést' in response
 
     def test_page_label_count(self):
@@ -413,12 +420,13 @@ class TestRootController(TestController):
         self.app.post(
             '/wiki/tést/update',
             params={
-                'title':'tést',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+                'title': 'tést',
+                'text': 'sometext',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
         content = file(__file__).read()
-        self.app.post('/wiki/tést/attach', upload_files=[('file_info', 'test_root.py', content)])
+        self.app.post('/wiki/tést/attach',
+                      upload_files=[('file_info', 'test_root.py', content)])
         response = self.app.get('/wiki/tést/')
         assert 'test_root.py' in response
 
@@ -426,12 +434,13 @@ class TestRootController(TestController):
         self.app.post(
             '/wiki/tést/update',
             params={
-                'title':'tést',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+                'title': 'tést',
+                'text': 'sometext',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
         content = file(__file__).read()
-        self.app.post('/wiki/tést/attach', upload_files=[('file_info', 'test1.py', content),('file_info', 'test2.py', content)])
+        self.app.post('/wiki/tést/attach',
+                      upload_files=[('file_info', 'test1.py', content), ('file_info', 'test2.py', content)])
         response = self.app.get('/wiki/tést/')
         assert 'test1.py' in response
         assert 'test2.py' in response
@@ -440,10 +449,10 @@ class TestRootController(TestController):
         self.app.post(
             '/wiki/tést/update',
             params={
-                'title':'tést',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+                'title': 'tést',
+                'text': 'sometext',
+                'labels': '',
+                'viewable_by-0.id': 'all'})
         file_name = 'test_root.py'
         file_data = file(__file__).read()
         upload = ('file_info', file_name, file_data)
@@ -454,12 +463,13 @@ class TestRootController(TestController):
 
     def test_new_image_attachment_content(self):
         self.app.post('/wiki/TEST/update', params={
-                'title':'TEST',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+            'title': 'TEST',
+            'text': 'sometext',
+            'labels': '',
+            'viewable_by-0.id': 'all'})
         file_name = 'neo-icon-set-454545-256x350.png'
-        file_path = os.path.join(allura.__path__[0],'nf','allura','images',file_name)
+        file_path = os.path.join(
+            allura.__path__[0], 'nf', 'allura', 'images', file_name)
         file_data = file(file_path).read()
         upload = ('file_info', file_name, file_data)
         self.app.post('/wiki/TEST/attach', upload_files=[upload])
@@ -468,18 +478,19 @@ class TestRootController(TestController):
         filename = page.attachments[0].filename
 
         uploaded = PIL.Image.open(file_path)
-        r = self.app.get('/wiki/TEST/attachment/'+filename)
+        r = self.app.get('/wiki/TEST/attachment/' + filename)
         downloaded = PIL.Image.open(StringIO.StringIO(r.body))
         assert uploaded.size == downloaded.size
-        r = self.app.get('/wiki/TEST/attachment/'+filename+'/thumb')
+        r = self.app.get('/wiki/TEST/attachment/' + filename + '/thumb')
 
         thumbnail = PIL.Image.open(StringIO.StringIO(r.body))
-        assert thumbnail.size == (255,255)
+        assert thumbnail.size == (255, 255)
 
         # Make sure thumbnail is absent
         r = self.app.get('/wiki/TEST/')
-        img_srcs = [ i['src'] for i in r.html.findAll('img') ]
-        assert ('/p/test/wiki/TEST/attachment/' + filename) not in img_srcs, img_srcs
+        img_srcs = [i['src'] for i in r.html.findAll('img')]
+        assert ('/p/test/wiki/TEST/attachment/' +
+                filename) not in img_srcs, img_srcs
 
     def test_sidebar_static_page(self):
         response = self.app.get('/wiki/tést/')
@@ -491,20 +502,20 @@ class TestRootController(TestController):
         assert 'Edit TEST' in response
         assert 'Related' not in response
         self.app.post('/wiki/TEST/update', params={
-                'title':'TEST',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+            'title': 'TEST',
+            'text': 'sometext',
+            'labels': '',
+            'viewable_by-0.id': 'all'})
         self.app.post('/wiki/aaa/update', params={
-                'title':'aaa',
-                'text':'',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+            'title': 'aaa',
+            'text': '',
+            'labels': '',
+            'viewable_by-0.id': 'all'})
         self.app.post('/wiki/bbb/update', params={
-                'title':'bbb',
-                'text':'',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+            'title': 'bbb',
+            'text': '',
+            'labels': '',
+            'viewable_by-0.id': 'all'})
 
         h.set_context('test', 'wiki', neighborhood='Projects')
         a = model.Page.query.find(dict(title='aaa')).first()
@@ -523,56 +534,63 @@ class TestRootController(TestController):
 
     def test_show_discussion(self):
         self.app.post('/wiki/tést/update', params={
-                'title':'tést',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+            'title': 'tést',
+            'text': 'sometext',
+            'labels': '',
+            'viewable_by-0.id': 'all'})
         wiki_page = self.app.get('/wiki/tést/')
-        assert wiki_page.html.find('div',{'id':'new_post_holder'})
-        options_admin = self.app.get('/admin/wiki/options', validate_chunk=True)
+        assert wiki_page.html.find('div', {'id': 'new_post_holder'})
+        options_admin = self.app.get(
+            '/admin/wiki/options', validate_chunk=True)
         assert options_admin.form['show_discussion'].checked
         options_admin.form['show_discussion'].checked = False
         options_admin.form.submit()
-        options_admin2 = self.app.get('/admin/wiki/options', validate_chunk=True)
+        options_admin2 = self.app.get(
+            '/admin/wiki/options', validate_chunk=True)
         assert not options_admin2.form['show_discussion'].checked
         wiki_page2 = self.app.get('/wiki/tést/')
-        assert not wiki_page2.html.find('div',{'id':'new_post_holder'})
+        assert not wiki_page2.html.find('div', {'id': 'new_post_holder'})
 
     def test_show_left_bar(self):
         self.app.post('/wiki/tést/update', params={
-                'title':'tést',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+            'title': 'tést',
+            'text': 'sometext',
+            'labels': '',
+            'viewable_by-0.id': 'all'})
         wiki_page = self.app.get('/wiki/tést/')
-        assert wiki_page.html.find('ul',{'class':'sidebarmenu'})
-        options_admin = self.app.get('/admin/wiki/options', validate_chunk=True)
+        assert wiki_page.html.find('ul', {'class': 'sidebarmenu'})
+        options_admin = self.app.get(
+            '/admin/wiki/options', validate_chunk=True)
         assert options_admin.form['show_left_bar'].checked
         options_admin.form['show_left_bar'].checked = False
         options_admin.form.submit()
-        options_admin2 = self.app.get('/admin/wiki/options', validate_chunk=True)
+        options_admin2 = self.app.get(
+            '/admin/wiki/options', validate_chunk=True)
         assert not options_admin2.form['show_left_bar'].checked
-        wiki_page2 = self.app.get('/wiki/tést/',extra_environ=dict(username='*anonymous'))
-        assert not wiki_page2.html.find('ul',{'class':'sidebarmenu'})
+        wiki_page2 = self.app.get(
+            '/wiki/tést/', extra_environ=dict(username='*anonymous'))
+        assert not wiki_page2.html.find('ul', {'class': 'sidebarmenu'})
         wiki_page3 = self.app.get('/wiki/tést/')
-        assert not wiki_page3.html.find('ul',{'class':'sidebarmenu'})
+        assert not wiki_page3.html.find('ul', {'class': 'sidebarmenu'})
 
     def test_show_metadata(self):
         self.app.post('/wiki/tést/update', params={
-                'title':'tést',
-                'text':'sometext',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+            'title': 'tést',
+            'text': 'sometext',
+            'labels': '',
+            'viewable_by-0.id': 'all'})
         wiki_page = self.app.get('/wiki/tést/')
-        assert wiki_page.html.find('div',{'class':'editbox'})
-        options_admin = self.app.get('/admin/wiki/options', validate_chunk=True)
+        assert wiki_page.html.find('div', {'class': 'editbox'})
+        options_admin = self.app.get(
+            '/admin/wiki/options', validate_chunk=True)
         assert options_admin.form['show_right_bar'].checked
         options_admin.form['show_right_bar'].checked = False
         options_admin.form.submit()
-        options_admin2 = self.app.get('/admin/wiki/options', validate_chunk=True)
+        options_admin2 = self.app.get(
+            '/admin/wiki/options', validate_chunk=True)
         assert not options_admin2.form['show_right_bar'].checked
         wiki_page2 = self.app.get('/wiki/tést/')
-        assert not wiki_page2.html.find('div',{'class':'editbox'})
+        assert not wiki_page2.html.find('div', {'class': 'editbox'})
 
     def test_edit_mount_label(self):
         r = self.app.get('/admin/wiki/edit_label', validate_chunk=True)
@@ -585,15 +603,15 @@ class TestRootController(TestController):
     def test_page_links_are_colored(self):
         self.app.get('/wiki/space%20page/')
         params = {
-            'title':'space page',
-            'text':'''There is a space in the title!''',
-            'labels':'',
-            'viewable_by-0.id':'all'}
+            'title': 'space page',
+            'text': '''There is a space in the title!''',
+            'labels': '',
+            'viewable_by-0.id': 'all'}
         self.app.post('/wiki/space%20page/update', params=params)
         self.app.get('/wiki/TEST/')
         params = {
-            'title':'TEST',
-            'text':'''
+            'title': 'TEST',
+            'text': '''
 * Here is a link to [this page](TEST)
 * Here is a link to [another page](Some page which does not exist)
 * Here is a link to [space page space](space page)
@@ -605,62 +623,65 @@ class TestRootController(TestController):
 * Here is a link to [another attach](TEST/attachment/attach.txt)
 * Here is a link to [attach](TEST/attachment/test_root.py)
 ''',
-            'labels':'',
-            'viewable_by-0.id':'all'}
+            'labels': '',
+            'viewable_by-0.id': 'all'}
         self.app.post('/wiki/TEST/update', params=params)
         content = file(__file__).read()
-        self.app.post('/wiki/TEST/attach', upload_files=[('file_info', 'test_root.py', content)])
+        self.app.post('/wiki/TEST/attach',
+                      upload_files=[('file_info', 'test_root.py', content)])
         r = self.app.get('/wiki/TEST/')
         found_links = 0
         for link in r.html.findAll('a'):
             if link.contents == ['this page']:
                 assert 'notfound' not in link.get('class', '')
-                found_links +=1
+                found_links += 1
             if link.contents == ['another page']:
                 assert 'notfound' not in link.get('class', '')
-                found_links +=1
+                found_links += 1
             if link.contents == ['space page space']:
                 assert 'notfound' not in link.get('class', '')
-                found_links +=1
+                found_links += 1
             if link.contents == ['space page escape']:
                 assert 'notfound' not in link.get('class', '')
-                found_links +=1
+                found_links += 1
             if link.contents == ['[TEST]']:
                 assert 'notfound' not in link.get('class', '')
-                found_links +=1
+                found_links += 1
             if link.contents == ['[Some page which does not exist]']:
                 assert 'notfound' in link.get('class', '')
-                found_links +=1
+                found_links += 1
             if link.contents == ['[space page]']:
                 assert 'notfound' not in link.get('class', '')
-                found_links +=1
+                found_links += 1
             if link.contents == ['[space%20page]']:
                 assert 'notfound' not in link.get('class', '')
-                found_links +=1
+                found_links += 1
             if link.contents == ['another attach']:
                 assert 'notfound' in link.get('class', '')
-                found_links +=1
+                found_links += 1
             if link.contents == ['attach']:
                 assert 'notfound' not in link.get('class', '')
-                found_links +=1
+                found_links += 1
         assert found_links == 10, 'Wrong number of links found'
 
     def test_home_rename(self):
-        assert 'The resource was found at http://localhost/p/test/wiki/Home/;' in self.app.get('/p/test/wiki/')
+        assert 'The resource was found at http://localhost/p/test/wiki/Home/;' in self.app.get(
+            '/p/test/wiki/')
         req = self.app.get('/p/test/wiki/Home/edit')
         req.forms[1]['title'].value = 'new_title'
         req.forms[1].submit()
-        assert 'The resource was found at http://localhost/p/test/wiki/new_title/;' in self.app.get('/p/test/wiki/')
+        assert 'The resource was found at http://localhost/p/test/wiki/new_title/;' in self.app.get(
+            '/p/test/wiki/')
 
     @patch.dict('allura.lib.app_globals.config', markdown_cache_threshold='0')
     def test_cached_html(self):
         """Ensure cached html is not escaped."""
         html = '<p><span>My Html</span></p>'
         self.app.post('/wiki/cache/update', params={
-                'title': 'cache',
-                'text': html,
-                'labels': '',
-                'viewable_by-0.id': 'all'})
+            'title': 'cache',
+            'text': html,
+            'labels': '',
+            'viewable_by-0.id': 'all'})
         # first request caches html, second serves from cache
         r = self.app.get('/wiki/cache/')
         r = self.app.get('/wiki/cache/')
@@ -668,15 +689,15 @@ class TestRootController(TestController):
 
     def test_page_delete(self):
         self.app.post('/wiki/aaa/update', params={
-                'title':'aaa',
-                'text':'',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+            'title': 'aaa',
+            'text': '',
+            'labels': '',
+            'viewable_by-0.id': 'all'})
         self.app.post('/wiki/bbb/update', params={
-                'title':'bbb',
-                'text':'',
-                'labels':'',
-                'viewable_by-0.id':'all'})
+            'title': 'bbb',
+            'text': '',
+            'labels': '',
+            'viewable_by-0.id': 'all'})
         response = self.app.get('/wiki/browse_pages/')
         assert 'aaa' in response
         assert 'bbb' in response
@@ -688,21 +709,21 @@ class TestRootController(TestController):
     def test_mailto_links(self):
         self.app.get('/wiki/test_mailto/')
         params = {
-            'title':'test_mailto',
-            'text':'''
+            'title': 'test_mailto',
+            'text': '''
 * Automatic mailto #1 <da...@deathstar.org>
 * Automatic mailto #2 <ma...@tatooine.org>
 * Handmaid mailto <a href="mailto:yoda@jedi.org">Email Yoda</a>
 ''',
-            'labels':'',
-            'viewable_by-0.id':'all'}
+            'labels': '',
+            'viewable_by-0.id': 'all'}
         self.app.post('/wiki/test_mailto/update', params=params)
         r = self.app.get('/wiki/test_mailto/')
         mailto_links = 0
         for link in r.html.findAll('a'):
             if link.get('href') == 'mailto:darth.vader@deathstar.org':
                 assert 'notfound' not in link.get('class', '')
-                mailto_links +=1
+                mailto_links += 1
             if link.get('href') == 'mailto:luke.skywalker@tatooine.org':
                 assert 'notfound' not in link.get('class', '')
                 mailto_links += 1

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/ForgeWiki/forgewiki/tests/test_app.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/test_app.py b/ForgeWiki/forgewiki/tests/test_app.py
index 103def4..484a6ee 100644
--- a/ForgeWiki/forgewiki/tests/test_app.py
+++ b/ForgeWiki/forgewiki/tests/test_app.py
@@ -53,7 +53,8 @@ class TestBulkExport(object):
         page = WM.Page.upsert('Return of the Jedi')
         page.text = 'Star Wars Episode VI: Return of the Jedi'
         page.commit()
-        page = WM.Page.query.get(app_config_id=self.wiki.config._id, title='Home')
+        page = WM.Page.query.get(
+            app_config_id=self.wiki.config._id, title='Home')
         page.deleted = True
         page.commit()
 
@@ -75,9 +76,11 @@ class TestBulkExport(object):
         assert_equal(len(pages[0]['discussion_thread']['posts']), 2)
 
         assert_equal(pages[1]['title'], 'Return of the Jedi')
-        assert_equal(pages[1]['text'], 'Star Wars Episode VI: Return of the Jedi')
+        assert_equal(pages[1]['text'],
+                     'Star Wars Episode VI: Return of the Jedi')
         assert_equal(len(pages[1]['discussion_thread']['posts']), 0)
 
         assert_equal(pages[2]['title'], 'The Empire Strikes Back')
-        assert_equal(pages[2]['text'], 'Star Wars Episode V: The Empire Strikes Back')
+        assert_equal(pages[2]['text'],
+                     'Star Wars Episode V: The Empire Strikes Back')
         assert_equal(len(pages[2]['discussion_thread']['posts']), 0)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/ForgeWiki/forgewiki/tests/test_wiki2markdown.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/test_wiki2markdown.py b/ForgeWiki/forgewiki/tests/test_wiki2markdown.py
index ff5c662..f021742 100644
--- a/ForgeWiki/forgewiki/tests/test_wiki2markdown.py
+++ b/ForgeWiki/forgewiki/tests/test_wiki2markdown.py
@@ -172,23 +172,23 @@ class TestMySQLExtractor(object):
         with open(os.path.join(self.options.dump_dir, 'pages/1/discussion.json'), 'r') as f:
             page = json.load(f)
         assert page == {
-                        'text': 'Talk for page Test 1.',
-                        'username': 'test-user',
-                        'timestamp': 1}
+            'text': 'Talk for page Test 1.',
+            'username': 'test-user',
+            'timestamp': 1}
 
         with open(os.path.join(self.options.dump_dir, 'pages/2/discussion.json'), 'r') as f:
             page = json.load(f)
         assert page == {
-                        'text': 'Talk for page Test 2.',
-                        'timestamp': 1,
-                        'username': 'test-user'}
+            'text': 'Talk for page Test 2.',
+            'timestamp': 1,
+            'username': 'test-user'}
 
         with open(os.path.join(self.options.dump_dir, 'pages/3/discussion.json'), 'r') as f:
             page = json.load(f)
         assert page == {
-                        'text': 'Talk for page Test 3.',
-                        'timestamp': 1,
-                        'username': 'test-user'}
+            'text': 'Talk for page Test 3.',
+            'timestamp': 1,
+            'username': 'test-user'}
 
 
 class TestMediawikiLoader(object):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/ForgeWiki/forgewiki/tests/test_wiki_roles.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/test_wiki_roles.py b/ForgeWiki/forgewiki/tests/test_wiki_roles.py
index 8971ede..64b5f03 100644
--- a/ForgeWiki/forgewiki/tests/test_wiki_roles.py
+++ b/ForgeWiki/forgewiki/tests/test_wiki_roles.py
@@ -24,19 +24,23 @@ from allura import model as M
 from allura.lib import security
 from allura.tests import decorators as td
 
+
 def setUp():
     setup_basic_test()
     setup_with_tools()
 
+
 @td.with_wiki
 def setup_with_tools():
     setup_global_objects()
     g.set_app('wiki')
 
+
 def test_role_assignments():
     admin = M.User.by_username('test-admin')
     user = M.User.by_username('test-user')
     anon = M.User.anonymous()
+
     def check_access(perm):
         pred = security.has_access(c.app, perm)
         return pred(user=admin), pred(user=user), pred(user=anon)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/ForgeWiki/forgewiki/widgets/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/widgets/wiki.py b/ForgeWiki/forgewiki/widgets/wiki.py
index 0cd174e..7dc8b56 100644
--- a/ForgeWiki/forgewiki/widgets/wiki.py
+++ b/ForgeWiki/forgewiki/widgets/wiki.py
@@ -18,14 +18,16 @@
 import ew.jinja2_ew as ew
 from allura.lib.widgets import form_fields as ffw
 
+
 class CreatePageWidget(ffw.Lightbox):
 
     def resources(self):
-        for r in super(CreatePageWidget, self).resources(): yield r
+        for r in super(CreatePageWidget, self).resources():
+            yield r
         yield ew.JSScript('''$(function () {
             $('#lightbox_create_wiki_page form').submit(function(){
                 location.href = $('#sidebar a.add_wiki_page').attr('href') +
                     encodeURIComponent($('input[name=name]', $(this)).val().replace('/', '-')) + '/edit';
                 return false;
             });
-        });''');
+        });''')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index e2112b6..0244f73 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -57,10 +57,11 @@ log = logging.getLogger(__name__)
 
 
 class W:
-    thread=w.Thread(
+    thread = w.Thread(
         page=None, limit=None, page_size=None, count=None,
         style='linear')
-    create_page_lightbox = CreatePageWidget(name='create_wiki_page', trigger='#sidebar a.add_wiki_page')
+    create_page_lightbox = CreatePageWidget(
+        name='create_wiki_page', trigger='#sidebar a.add_wiki_page')
     markdown_editor = ffw.MarkdownEdit()
     label_edit = ffw.LabelEdit()
     attachment_add = ffw.AttachmentAdd()
@@ -71,17 +72,19 @@ class W:
     page_size = ffw.PageSize()
     search_results = SearchResults()
     help_modal = SearchHelp()
-    icons={
-        24:'images/wiki_24.png',
-        32:'images/wiki_32.png',
-        48:'images/wiki_48.png'
+    icons = {
+        24: 'images/wiki_24.png',
+        32: 'images/wiki_32.png',
+        48: 'images/wiki_48.png'
     }
 
+
 class ForgeWikiApp(Application):
+
     '''This is the Wiki app for PyForge'''
     __version__ = version.__version__
-    permissions = [ 'configure', 'read', 'create', 'edit', 'delete',
-                    'unmoderated_post', 'post', 'moderate', 'admin']
+    permissions = ['configure', 'read', 'create', 'edit', 'delete',
+                   'unmoderated_post', 'post', 'moderate', 'admin']
     permissions_desc = {
         'read': 'View wiki pages.',
         'create': 'Create wiki pages.',
@@ -89,21 +92,21 @@ class ForgeWikiApp(Application):
         'delete': 'Delete wiki pages.',
         'admin': 'Set permissions. Configure options. Set wiki home page.',
     }
-    searchable=True
-    exportable=True
-    tool_label='Wiki'
-    tool_description="""
+    searchable = True
+    exportable = True
+    tool_label = 'Wiki'
+    tool_description = """
         Documentation is key to your project and the wiki tool
         helps make it easy for anyone to contribute.
     """
-    default_mount_label='Wiki'
-    default_mount_point='wiki'
-    ordinal=5
+    default_mount_label = 'Wiki'
+    default_mount_point = 'wiki'
+    ordinal = 5
     default_root_page_name = u'Home'
-    icons={
-        24:'images/wiki_24.png',
-        32:'images/wiki_32.png',
-        48:'images/wiki_48.png'
+    icons = {
+        24: 'images/wiki_24.png',
+        32: 'images/wiki_32.png',
+        48: 'images/wiki_48.png'
     }
 
     def __init__(self, project, config):
@@ -134,12 +137,14 @@ class ForgeWikiApp(Application):
             else:
                 page_name = self.default_root_page_name
             return page_name
+
         def fset(self, new_root_page_name):
             globals = WM.Globals.query.get(app_config_id=self.config._id)
             if globals is not None:
                 globals.root = new_root_page_name
             elif new_root_page_name != self.default_root_page_name:
-                globals = WM.Globals(app_config_id=self.config._id, root=new_root_page_name)
+                globals = WM.Globals(
+                    app_config_id=self.config._id, root=new_root_page_name)
             if globals is not None:
                 session(globals).flush(globals)
 
@@ -147,6 +152,7 @@ class ForgeWikiApp(Application):
     def show_discussion():
         def fget(self):
             return self.config.options.get('show_discussion', True)
+
         def fset(self, show):
             self.config.options['show_discussion'] = bool(show)
 
@@ -154,6 +160,7 @@ class ForgeWikiApp(Application):
     def show_left_bar():
         def fget(self):
             return self.config.options.get('show_left_bar', True)
+
         def fset(self, show):
             self.config.options['show_left_bar'] = bool(show)
 
@@ -161,6 +168,7 @@ class ForgeWikiApp(Application):
     def show_right_bar():
         def fget(self):
             return self.config.options.get('show_right_bar', True)
+
         def fset(self, show):
             self.config.options['show_right_bar'] = bool(show)
 
@@ -168,9 +176,9 @@ class ForgeWikiApp(Application):
         '''Apps should provide their entries to be added to the main nav
         :return: a list of :class:`SitemapEntries <allura.app.SitemapEntry>`
         '''
-        return [ SitemapEntry(
-                self.config.options.mount_label,
-                '.')]
+        return [SitemapEntry(
+            self.config.options.mount_label,
+            '.')]
 
     @property
     @h.exceptionless([], log)
@@ -180,10 +188,10 @@ class ForgeWikiApp(Application):
             pages = [
                 SitemapEntry(p.title, p.url())
                 for p in WM.Page.query.find(dict(
-                        app_config_id=self.config._id,
-                        deleted=False)) ]
+                    app_config_id=self.config._id,
+                    deleted=False))]
             return [
-                SitemapEntry(menu_id, '.')[SitemapEntry('Pages')[pages]] ]
+                SitemapEntry(menu_id, '.')[SitemapEntry('Pages')[pages]]]
 
     def create_common_wiki_menu(self,
                                 has_create_access,
@@ -193,42 +201,46 @@ class ForgeWikiApp(Application):
         links = []
         if has_create_access:
             links += [SitemapEntry('Create Page', create_page_url,
-                                    ui_icon=g.icons['plus'],
-                                    className=create_page_class)]
+                                   ui_icon=g.icons['plus'],
+                                   className=create_page_class)]
         if not admin_menu:
             links += [SitemapEntry(''),
-                SitemapEntry('Wiki Home', self.url, className='wiki_home')]
+                      SitemapEntry('Wiki Home', self.url, className='wiki_home')]
         links += [SitemapEntry('Browse Pages', self.url + 'browse_pages/'),
                   SitemapEntry('Browse Labels', self.url + 'browse_tags/')]
         discussion = c.app.config.discussion
-        pending_mod_count = M.Post.query.find({'discussion_id':discussion._id, 'status':'pending'}).count() if discussion else 0
+        pending_mod_count = M.Post.query.find(
+            {'discussion_id': discussion._id, 'status': 'pending'}).count() if discussion else 0
         if pending_mod_count and h.has_access(discussion, 'moderate')():
-            links.append(SitemapEntry('Moderate', discussion.url() + 'moderate', ui_icon=g.icons['pencil'],
-                small = pending_mod_count))
+            links.append(
+                SitemapEntry(
+                    'Moderate', discussion.url() + 'moderate', ui_icon=g.icons['pencil'],
+                    small=pending_mod_count))
         if not admin_menu:
             links += [SitemapEntry(''),
-                SitemapEntry('Formatting Help',self.url+'markdown_syntax/')]
+                      SitemapEntry('Formatting Help', self.url + 'markdown_syntax/')]
         return links
 
     def admin_menu(self):
         admin_url = c.project.url() + \
-                    'admin/' + \
-                    self.config.options.mount_point + '/'
+            'admin/' + \
+            self.config.options.mount_point + '/'
         links = [SitemapEntry('Set Home',
                               admin_url + 'home',
                               className='admin_modal')]
 
         if not self.show_left_bar:
             links += self.create_common_wiki_menu(True,
-                        admin_url + 'create_wiki_page',
-                        'admin_modal', admin_menu=True)
+                                                  admin_url +
+                                                  'create_wiki_page',
+                                                  'admin_modal', admin_menu=True)
         links += super(ForgeWikiApp, self).admin_menu(force_options=True)
 
         return links
 
     @h.exceptionless([], log)
     def sidebar_menu(self):
-        return self.create_common_wiki_menu(has_access(self, 'create'),c.app.url,'add_wiki_page')
+        return self.create_common_wiki_menu(has_access(self, 'create'), c.app.url, 'add_wiki_page')
 
     def install(self, project):
         'Set up any default permissions and roles here'
@@ -250,13 +262,14 @@ class ForgeWikiApp(Application):
             M.ACE.allow(role_developer, 'moderate'),
             M.ACE.allow(role_admin, 'configure'),
             M.ACE.allow(role_admin, 'admin'),
-            ]
+        ]
         root_page_name = self.default_root_page_name
         WM.Globals(app_config_id=c.app.config._id, root=root_page_name)
         self.upsert_root(root_page_name)
 
     def upsert_root(self, new_root):
-        p = WM.Page.query.get(app_config_id=self.config._id, title=new_root, deleted=False)
+        p = WM.Page.query.get(app_config_id=self.config._id,
+                              title=new_root, deleted=False)
         if p is None:
             with h.push_config(c, app=self):
                 p = WM.Page.upsert(new_root)
@@ -273,7 +286,6 @@ The wiki uses [Markdown](%s) syntax.
 """ % url
                 p.commit()
 
-
     def uninstall(self, project):
         "Remove all the tool's artifacts from the database"
         WM.WikiAttachment.query.remove(dict(app_config_id=self.config._id))
@@ -305,7 +317,7 @@ class RootController(BaseController, DispatchIndex, FeedController):
     @with_trailing_slash
     @expose()
     def index(self, **kw):
-        redirect(h.really_unicode(c.app.root_page_name).encode('utf-8')+'/')
+        redirect(h.really_unicode(c.app.root_page_name).encode('utf-8') + '/')
 
     @expose()
     def _lookup(self, pname, *remainder):
@@ -376,10 +388,11 @@ class RootController(BaseController, DispatchIndex, FeedController):
                 else:
                     pages.append(p)
         if sort == 'recent':
-            pages.sort(reverse=True, key=lambda x:(x['updated']))
+            pages.sort(reverse=True, key=lambda x: (x['updated']))
             pages = pages + uv_pages
-        return dict(pages=pages, can_delete=can_delete, show_deleted=show_deleted,
-                    limit=limit, count=count, page=pagenum)
+        return dict(
+            pages=pages, can_delete=can_delete, show_deleted=show_deleted,
+            limit=limit, count=count, page=pagenum)
 
     @with_trailing_slash
     @expose('jinja:forgewiki:templates/wiki/browse_tags.html')
@@ -451,7 +464,8 @@ class PageController(BaseController, FeedController):
             attachments=[])
 
     def get_version(self, version):
-        if not version: return self.page
+        if not version:
+            return self.page
         try:
             return self.page.get_version(version)
         except (ValueError, IndexError):
@@ -473,7 +487,7 @@ class PageController(BaseController, FeedController):
                    limit=validators.Int(if_empty=25, if_invalid=25)))
     def index(self, version=None, page=0, limit=25, **kw):
         if not self.page:
-            redirect(c.app.url+h.urlquote(self.title)+'/edit')
+            redirect(c.app.url + h.urlquote(self.title) + '/edit')
         c.thread = W.thread
         c.attachment_list = W.attachment_list
         c.subscribe_form = W.page_subscribe_form
@@ -481,14 +495,18 @@ class PageController(BaseController, FeedController):
         limit, pagenum = h.paging_sanitizer(limit, page, post_count)
         page = self.get_version(version)
         if page is None:
-            if version: redirect('.?version=%d' % (version-1))
-            else: redirect('.')
+            if version:
+                redirect('.?version=%d' % (version - 1))
+            else:
+                redirect('.')
         elif 'all' not in page.viewable_by and c.user.username not in page.viewable_by:
             raise exc.HTTPForbidden(detail="You may not view this page.")
         cur = page.version
-        if cur > 1: prev = cur-1
-        else: prev = None
-        next = cur+1
+        if cur > 1:
+            prev = cur - 1
+        else:
+            prev = None
+        next = cur + 1
         hide_left_bar = not (c.app.show_left_bar)
         return dict(
             page=page,
@@ -513,7 +531,7 @@ class PageController(BaseController, FeedController):
         c.label_edit = W.label_edit
         hide_left_bar = not c.app.show_left_bar
         return dict(page=page, page_exists=page_exists,
-            hide_left_bar=hide_left_bar)
+                    hide_left_bar=hide_left_bar)
 
     @without_trailing_slash
     @expose('json')
@@ -521,7 +539,7 @@ class PageController(BaseController, FeedController):
     def delete(self):
         require_access(self.page, 'delete')
         self.page.delete()
-        return dict(location='../'+self.page.title+'/?deleted=True')
+        return dict(location='../' + self.page.title + '/?deleted=True')
 
     @without_trailing_slash
     @expose('json')
@@ -552,8 +570,8 @@ class PageController(BaseController, FeedController):
     @without_trailing_slash
     @expose('jinja:forgewiki:templates/wiki/page_diff.html')
     @validate(dict(
-            v1=validators.Int(),
-            v2=validators.Int()))
+        v1=validators.Int(),
+        v2=validators.Int()))
     def diff(self, v1, v2, **kw):
         if not self.page:
             raise exc.HTTPNotFound
@@ -604,10 +622,10 @@ class PageController(BaseController, FeedController):
     def update(self, title=None, text=None,
                labels=None,
                viewable_by=None,
-               new_viewable_by=None,**kw):
+               new_viewable_by=None, **kw):
         activity_verb = 'created'
         if not title:
-            flash('You must provide a title for the page.','error')
+            flash('You must provide a title for the page.', 'error')
             redirect('edit')
         title = title.replace('/', '-')
         if not self.page:
@@ -619,12 +637,14 @@ class PageController(BaseController, FeedController):
             activity_verb = 'modified'
         name_conflict = None
         if self.page.title != title:
-            name_conflict = WM.Page.query.find(dict(app_config_id=c.app.config._id, title=title, deleted=False)).first()
+            name_conflict = WM.Page.query.find(
+                dict(app_config_id=c.app.config._id, title=title, deleted=False)).first()
             if name_conflict:
                 flash('There is already a page named "%s".' % title, 'error')
             else:
                 if self.page.title == c.app.root_page_name:
-                    WM.Globals.query.get(app_config_id=c.app.config._id).root = title
+                    WM.Globals.query.get(
+                        app_config_id=c.app.config._id).root = title
                 self.page.title = title
                 activity_verb = 'renamed'
         self.page.text = text
@@ -633,9 +653,10 @@ class PageController(BaseController, FeedController):
         else:
             self.page.labels = []
         self.page.commit()
-        g.spam_checker.check(text, artifact=self.page, user=c.user, content_type='wiki')
+        g.spam_checker.check(text, artifact=self.page,
+                             user=c.user, content_type='wiki')
         g.director.create_activity(c.user, activity_verb, self.page,
-                target=c.project)
+                                   target=c.project)
         if new_viewable_by:
             if new_viewable_by == 'all':
                 self.page.viewable_by.append('all')
@@ -652,7 +673,8 @@ class PageController(BaseController, FeedController):
                         user = M.User.by_username(str(u['id']))
                         if user:
                             self.page.viewable_by.remove(user.username)
-        redirect('../' + h.really_unicode(self.page.title).encode('utf-8') + ('/' if not name_conflict else '/edit'))
+        redirect('../' + h.really_unicode(self.page.title)
+                 .encode('utf-8') + ('/' if not name_conflict else '/edit'))
 
     @without_trailing_slash
     @expose()
@@ -675,14 +697,16 @@ class PageController(BaseController, FeedController):
             self.page.unsubscribe()
         redirect(request.referer)
 
+
 class WikiAttachmentController(ac.AttachmentController):
     AttachmentClass = WM.WikiAttachment
     edit_perm = 'edit'
 
+
 class WikiAttachmentsController(ac.AttachmentsController):
     AttachmentControllerClass = WikiAttachmentController
 
-MARKDOWN_EXAMPLE='''
+MARKDOWN_EXAMPLE = '''
 # First-level heading
 
 Some *emphasized* and **strong** text
@@ -691,6 +715,7 @@ Some *emphasized* and **strong** text
 
 '''
 
+
 class RootRestController(BaseController):
 
     def __init__(self):
@@ -702,7 +727,8 @@ class RootRestController(BaseController):
     @expose('json:')
     def index(self, **kw):
         page_titles = []
-        pages = WM.Page.query.find(dict(app_config_id=c.app.config._id, deleted=False))
+        pages = WM.Page.query.find(
+            dict(app_config_id=c.app.config._id, deleted=False))
         for page in pages:
             if has_access(page, 'read')():
                 page_titles.append(page.title)
@@ -786,8 +812,10 @@ class WikiAdminController(DefaultAdminController):
         self.app.root_page_name = new_home
         self.app.upsert_root(new_home)
         flash('Home updated')
-        mount_base = c.project.url()+self.app.config.options.mount_point+'/'
-        url = h.really_unicode(mount_base).encode('utf-8') + h.really_unicode(new_home).encode('utf-8')+'/'
+        mount_base = c.project.url() + \
+            self.app.config.options.mount_point + '/'
+        url = h.really_unicode(mount_base).encode('utf-8') + \
+            h.really_unicode(new_home).encode('utf-8') + '/'
         redirect(url)
 
     @without_trailing_slash
@@ -798,4 +826,4 @@ class WikiAdminController(DefaultAdminController):
         self.app.show_left_bar = show_left_bar
         self.app.show_right_bar = show_right_bar
         flash('Wiki options updated')
-        redirect(c.project.url()+'admin/tools')
+        redirect(c.project.url() + 'admin/tools')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/ForgeWiki/setup.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/setup.py b/ForgeWiki/setup.py
index dce7390..6bc7944 100644
--- a/ForgeWiki/setup.py
+++ b/ForgeWiki/setup.py
@@ -16,7 +16,8 @@
 #       under the License.
 
 from setuptools import setup, find_packages
-import sys, os
+import sys
+import os
 
 from forgewiki.version import __version__
 
@@ -25,7 +26,8 @@ setup(name='ForgeWiki',
       description="",
       long_description="""\
 """,
-      classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
+      # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
+      classifiers=[],
       keywords='',
       author='',
       author_email='',

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/NoWarnings/nowarnings.py
----------------------------------------------------------------------
diff --git a/NoWarnings/nowarnings.py b/NoWarnings/nowarnings.py
index 27671b7..e81d745 100644
--- a/NoWarnings/nowarnings.py
+++ b/NoWarnings/nowarnings.py
@@ -18,6 +18,7 @@
 import warnings
 from nose.plugins import Plugin
 
+
 class NoWarnings(Plugin):
 
     def beforeTest(self, result):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/fuse/accessfs.py
----------------------------------------------------------------------
diff --git a/fuse/accessfs.py b/fuse/accessfs.py
index 44f1cc6..56808f8 100644
--- a/fuse/accessfs.py
+++ b/fuse/accessfs.py
@@ -40,6 +40,7 @@ logging.basicConfig()
 fuse.fuse_python_api = (0, 2)
 fuse.feature_assert('stateful_files', 'has_init')
 
+
 class check_access(object):
 
     def __init__(self, *args, **kwargs):
@@ -58,10 +59,12 @@ class check_access(object):
         return wrapper
 
     def check(self, inst, path, mode):
-        if mode is None: return
+        if mode is None:
+            return
         rc = inst.access(path, mode)
         if rc:
-            raise OSError(errno.EPERM, path,'Permission denied')
+            raise OSError(errno.EPERM, path, 'Permission denied')
+
 
 class check_and_translate(check_access):
 
@@ -69,6 +72,7 @@ class check_and_translate(check_access):
         super(check_and_translate, self).check(inst, path, mode)
         return inst._to_global(path)
 
+
 def flag2mode(flags):
     md = {os.O_RDONLY: 'r', os.O_WRONLY: 'w', os.O_RDWR: 'w+'}
     m = md[flags & (os.O_RDONLY | os.O_WRONLY | os.O_RDWR)]
@@ -76,6 +80,7 @@ def flag2mode(flags):
         m = m.replace('w', 'a', 1)
     return m
 
+
 class AccessFS(fuse.Fuse):
 
     def __init__(self, *args, **kw):
@@ -148,7 +153,8 @@ class AccessFS(fuse.Fuse):
         os.utime("." + path, times)
 
     def access(self, path, mode):
-        if mode & (os.R_OK|os.W_OK) == 0: return
+        if mode & (os.R_OK | os.W_OK) == 0:
+            return
         ctx = fuse.FuseGetContext()
         entry = self.perm_cache.get(ctx['uid'], path)
         if (mode & entry) != mode:
@@ -157,7 +163,7 @@ class AccessFS(fuse.Fuse):
     def _assert_access(self, path, mode):
         rc = self.access(path, mode)
         if rc:
-            raise OSError(errno.EPERM, path,'Permission denied')
+            raise OSError(errno.EPERM, path, 'Permission denied')
 
     def statfs(self):
         """
@@ -191,18 +197,19 @@ class AccessFS(fuse.Fuse):
 
     def make_file_class(self):
         class FSAccessFile(AccessFile):
-            filesystem=self
+            filesystem = self
         return FSAccessFile
 
+
 class AccessFile(fuse.FuseFileInfo):
-    direct_io=False
+    direct_io = False
     keep_cache = False
     needs_write = (
         os.O_WRONLY
         | os.O_RDWR
         | os.O_APPEND
         | os.O_CREAT
-        | os.O_TRUNC )
+        | os.O_TRUNC)
 
     def __init__(self, path, flags, *mode):
         access_mode = os.R_OK
@@ -272,9 +279,9 @@ class AccessFile(fuse.FuseFileInfo):
 
         # Convert fcntl-ish lock parameters to Python's weird
         # lockf(3)/flock(2) medley locking API...
-        op = { fcntl.F_UNLCK : fcntl.LOCK_UN,
-               fcntl.F_RDLCK : fcntl.LOCK_SH,
-               fcntl.F_WRLCK : fcntl.LOCK_EX }[kw['l_type']]
+        op = {fcntl.F_UNLCK: fcntl.LOCK_UN,
+              fcntl.F_RDLCK: fcntl.LOCK_SH,
+              fcntl.F_WRLCK: fcntl.LOCK_EX}[kw['l_type']]
         if cmd == fcntl.F_GETLK:
             return -errno.EOPNOTSUPP
         elif cmd == fcntl.F_SETLK:
@@ -287,6 +294,7 @@ class AccessFile(fuse.FuseFileInfo):
 
         fcntl.lockf(self.fd, op, kw['l_start'], kw['l_len'])
 
+
 class PermissionCache(object):
 
     def __init__(self, uid_cache, host, timeout=30, size=1024):
@@ -305,7 +313,8 @@ class PermissionCache(object):
             if elapsed > self._timeout:
                 print 'Timeout!', elapsed
                 uname = self._uid_cache.get(uid)
-                entry = self._refresh_result(uid, path, self._api_lookup(uname, path))
+                entry = self._refresh_result(
+                    uid, path, self._api_lookup(uname, path))
                 return entry
             return entry
         except KeyError:
@@ -327,20 +336,22 @@ class PermissionCache(object):
             self._host
             + '/auth/repo_permissions?'
             + urllib.urlencode(dict(
-                    repo_path=path,
-                    username=uname)))
+                repo_path=path,
+                username=uname)))
         print 'Checking access for %s at %s (%s)' % (uname, url, path)
         fp = urllib2.urlopen(url)
         result = json.load(fp)
         print result
         entry = 0
-        if result['allow_read']: entry |= os.R_OK
-        if result['allow_write']: entry |= os.W_OK
+        if result['allow_read']:
+            entry |= os.R_OK
+        if result['allow_write']:
+            entry |= os.W_OK
         return entry
 
     def _refresh_result(self, uid, path, value):
         with self._lock:
-            if (uid,path) in self._data:
+            if (uid, path) in self._data:
                 self._data[uid, path] = (value, time.time())
             else:
                 if len(self._data) >= self._size:
@@ -362,11 +373,12 @@ class PermissionCache(object):
         '''Convert paths from the form /SCM/neighborhood/project/a/b/c to
         /SCM/project.neighborhood/a/b/c
         '''
-        parts = [ p for p in path.split(os.path.sep) if p ]
+        parts = [p for p in path.split(os.path.sep) if p]
         scm, nbhd, proj, rest = parts[0], parts[1], parts[2], parts[3:]
-        parts = ['/SCM/%s.%s' % (proj, nbhd) ] + rest
+        parts = ['/SCM/%s.%s' % (proj, nbhd)] + rest
         return '/'.join(parts)
 
+
 class UnixUsernameCache(object):
 
     def __init__(self):
@@ -381,6 +393,7 @@ class UnixUsernameCache(object):
         self._cache[uid] = uname
         return uname
 
+
 def main():
 
     usage = """
@@ -389,8 +402,8 @@ Userspace nullfs-alike: mirror the filesystem tree from some point on.
 """ + fuse.Fuse.fusage
 
     server = AccessFS(version="%prog " + fuse.__version__,
-                 usage=usage,
-                 dash_s_do='setsingle')
+                      usage=usage,
+                      dash_s_do='setsingle')
 
     server.parser.add_option(mountopt="root", metavar="PATH", default='/',
                              help="mirror filesystem from under PATH [default: %default]")

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/run_tests
----------------------------------------------------------------------
diff --git a/run_tests b/run_tests
index 4180aa9..7ae6547 100755
--- a/run_tests
+++ b/run_tests
@@ -33,13 +33,14 @@ CONCURRENT_TESTS = (CPUS // CONCURRENT_SUITES) or 1
 PROC_TIMEOUT = 120
 
 ALT_PKG_PATHS = {
-        'Allura': 'allura/tests/',
-        }
+    'Allura': 'allura/tests/',
+}
 
 NOT_MULTIPROC_SAFE = [
-        'ForgeGit',
-        'ForgeSVN',
-        ]
+    'ForgeGit',
+    'ForgeSVN',
+]
+
 
 def run_one(cmd, **popen_kwargs):
     print '{} running {} {}'.format(threading.current_thread(), cmd, popen_kwargs)
@@ -114,13 +115,15 @@ def run_tests_in_parallel(options, nosetests_args):
 
     def get_pkg_path(pkg):
         return ALT_PKG_PATHS.get(pkg, '')
+
     def get_multiproc_args(pkg):
         if not use_multiproc:
             return ''
         return ('--processes={procs_per_suite} --process-timeout={proc_timeout}'.format(
-                    procs_per_suite=options.concurrent_tests,
-                    proc_timeout=PROC_TIMEOUT)
-                if pkg not in NOT_MULTIPROC_SAFE else '')
+            procs_per_suite=options.concurrent_tests,
+            proc_timeout=PROC_TIMEOUT)
+            if pkg not in NOT_MULTIPROC_SAFE else '')
+
     def get_concurrent_suites():
         if use_multiproc or '-n' in sys.argv:
             return options.concurrent_suites
@@ -141,8 +144,9 @@ def run_tests_in_parallel(options, nosetests_args):
 
 
 def parse_args():
-    parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
-                                     epilog=textwrap.dedent('''
+    parser = argparse.ArgumentParser(
+        formatter_class=argparse.RawDescriptionHelpFormatter,
+        epilog=textwrap.dedent('''
                                         All additional arguments are passed along to nosetests
                                           (e.g. -v --with-coverage)
                                         Note: --cover-package will be set automatically to the appropriate value'''))
@@ -152,9 +156,10 @@ def parse_args():
     parser.add_argument('-m', help='Number of tests to run concurrently in separate '
                                    'processes, per suite. Default: # CPUs / # concurrent suites',
                         dest='concurrent_tests', type=int, default=CONCURRENT_TESTS)
-    parser.add_argument('-p', help='List of packages to run tests on. Default: all',
-                        dest='packages', choices=get_packages(), default=get_packages(),
-                        nargs='+')
+    parser.add_argument(
+        '-p', help='List of packages to run tests on. Default: all',
+        dest='packages', choices=get_packages(), default=get_packages(),
+        nargs='+')
     return parser.parse_known_args()
 
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/scripts/add_user_to_group.py
----------------------------------------------------------------------
diff --git a/scripts/add_user_to_group.py b/scripts/add_user_to_group.py
index 1047999..aa2fe1e 100644
--- a/scripts/add_user_to_group.py
+++ b/scripts/add_user_to_group.py
@@ -39,12 +39,13 @@ Example:
 from allura import model as M
 from ming.orm import ThreadLocalORMSession
 
+
 def main(options):
     nbhd = M.Neighborhood.query.get(url_prefix=options.nbhd)
     if not nbhd:
         return "Couldn't find neighborhood with url_prefix '%s'" % options.nbhd
     project = M.Project.query.get(neighborhood_id=nbhd._id,
-            shortname=options.project)
+                                  shortname=options.project)
     if not project:
         return "Couldn't find project with shortname '%s'" % options.project
     user = M.User.by_username(options.user)
@@ -53,7 +54,8 @@ def main(options):
     project_role = M.ProjectRole.by_name(options.group, project=project)
     if not project_role:
         return "Couldn't find group (ProjectRole) with name '%s'" % options.group
-    user_roles = M.ProjectRole.by_user(user, project=project, upsert=True).roles
+    user_roles = M.ProjectRole.by_user(
+        user, project=project, upsert=True).roles
     if project_role._id not in user_roles:
         user_roles.append(project_role._id)
     ThreadLocalORMSession.flush_all()
@@ -62,14 +64,14 @@ def main(options):
 def parse_options():
     import argparse
     parser = argparse.ArgumentParser(description=__doc__,
-            formatter_class=argparse.RawDescriptionHelpFormatter)
+                                     formatter_class=argparse.RawDescriptionHelpFormatter)
     parser.add_argument('user', help='Username')
     parser.add_argument('group', help='Group (ProjectRole) name, e.g. Admin, '
-            'Member, Developer, etc.')
+                        'Member, Developer, etc.')
     parser.add_argument('project', nargs='?', default='--init--',
-            help='Project shortname. Default is --init--.')
+                        help='Project shortname. Default is --init--.')
     parser.add_argument('--nbhd', default='/p/', help='Neighborhood '
-            'url_prefix. Default is /p/.')
+                        'url_prefix. Default is /p/.')
     return parser.parse_args()
 
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/scripts/allura_import.py
----------------------------------------------------------------------
diff --git a/scripts/allura_import.py b/scripts/allura_import.py
index b05d524..0f2f715 100644
--- a/scripts/allura_import.py
+++ b/scripts/allura_import.py
@@ -45,22 +45,26 @@ def main():
                 if not isinstance(k, basestring) or not isinstance(v, basestring):
                     raise ValueError
         except ValueError:
-            optparser.error('--user-map should specify JSON file with format {"original_user": "sf_user", ...}')
+            optparser.error(
+                '--user-map should specify JSON file with format {"original_user": "sf_user", ...}')
         finally:
             f.close()
 
     import_options['user_map'] = user_map
 
-    cli = AlluraImportApiClient(options.base_url, options.api_key, options.secret_key, options.verbose)
+    cli = AlluraImportApiClient(
+        options.base_url, options.api_key, options.secret_key, options.verbose)
     doc_txt = open(args[0]).read()
 
     # import the tracker (if any)
     if options.tracker:
-        import_tracker(cli, options.project, options.tracker, import_options, options, doc_txt,
-                       validate=options.validate,
-                       verbose=options.verbose)
+        import_tracker(
+            cli, options.project, options.tracker, import_options, options, doc_txt,
+            validate=options.validate,
+            verbose=options.verbose)
     elif options.forum:
-        import_forum(cli, options.project, options.forum, user_map, doc_txt, validate=options.validate)
+        import_forum(cli, options.project, options.forum,
+                     user_map, doc_txt, validate=options.validate)
     elif options.wiki:
         import_wiki(cli, options.project, options.wiki, options, doc_txt)
 
@@ -79,18 +83,30 @@ def parse_options():
     optparser = OptionParser(usage='''%prog [options] <JSON dump>
 
 Import project data dump in JSON format into an Allura project.''')
-    optparser.add_option('-a', '--api-ticket', dest='api_key', help='API ticket')
-    optparser.add_option('-s', '--secret-key', dest='secret_key', help='Secret key')
-    optparser.add_option('-p', '--project', dest='project', help='Project to import to')
-    optparser.add_option('-t', '--tracker', dest='tracker', help='Tracker to import to')
-    optparser.add_option('-f', '--forum', dest='forum', help='Forum tool to import to')
-    optparser.add_option('-w', '--wiki', dest='wiki', help='Wiki tool to import to')
-    optparser.add_option('-u', '--base-url', dest='base_url', default='https://sourceforge.net', help='Base Allura URL (%default)')
-    optparser.add_option('-o', dest='import_opts', default=[], action='append', help='Specify import option(s)', metavar='opt=val')
-    optparser.add_option('--user-map', dest='user_map_file', help='Map original users to SF.net users', metavar='JSON_FILE')
-    optparser.add_option('--validate', dest='validate', action='store_true', help='Validate import data')
-    optparser.add_option('-v', '--verbose', dest='verbose', action='store_true', help='Verbose operation')
-    optparser.add_option('-c', '--continue', dest='cont', action='store_true', help='Continue import into existing tracker')
+    optparser.add_option('-a', '--api-ticket',
+                         dest='api_key', help='API ticket')
+    optparser.add_option('-s', '--secret-key',
+                         dest='secret_key', help='Secret key')
+    optparser.add_option('-p', '--project', dest='project',
+                         help='Project to import to')
+    optparser.add_option('-t', '--tracker', dest='tracker',
+                         help='Tracker to import to')
+    optparser.add_option('-f', '--forum', dest='forum',
+                         help='Forum tool to import to')
+    optparser.add_option('-w', '--wiki', dest='wiki',
+                         help='Wiki tool to import to')
+    optparser.add_option('-u', '--base-url', dest='base_url',
+                         default='https://sourceforge.net', help='Base Allura URL (%default)')
+    optparser.add_option('-o', dest='import_opts',
+                         default=[], action='append', help='Specify import option(s)', metavar='opt=val')
+    optparser.add_option('--user-map', dest='user_map_file',
+                         help='Map original users to SF.net users', metavar='JSON_FILE')
+    optparser.add_option('--validate', dest='validate',
+                         action='store_true', help='Validate import data')
+    optparser.add_option('-v', '--verbose', dest='verbose',
+                         action='store_true', help='Verbose operation')
+    optparser.add_option('-c', '--continue', dest='cont',
+                         action='store_true', help='Continue import into existing tracker')
     options, args = optparser.parse_args()
     if len(args) != 1:
         optparser.error("Wrong number of arguments")

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/scripts/changelog.py
----------------------------------------------------------------------
diff --git a/scripts/changelog.py b/scripts/changelog.py
index 2d6a40d..d138376 100755
--- a/scripts/changelog.py
+++ b/scripts/changelog.py
@@ -38,6 +38,7 @@ def main():
 def get_versions():
     return sys.argv[1], sys.argv[2], sys.argv[3]
 
+
 def get_tickets(from_ref, to_ref):
     repo = git.Repo('.')
     ticket_nums = set()
@@ -48,6 +49,7 @@ def get_tickets(from_ref, to_ref):
             ticket_nums.add(match.group(1))
     return list(ticket_nums)
 
+
 def get_ticket_summaries(tickets):
     summaries = {}
     r = requests.get(API_URL.format(' '.join(tickets)))
@@ -57,11 +59,12 @@ def get_ticket_summaries(tickets):
         summaries[ticket['ticket_num']] = ticket['summary']
     return summaries
 
+
 def print_changelog(version, summaries):
     print 'Version {version}  ({date})\n'.format(**{
-            'version': version,
-            'date': datetime.utcnow().strftime('%B %Y'),
-        })
+        'version': version,
+        'date': datetime.utcnow().strftime('%B %Y'),
+    })
     for ticket in sorted(summaries.keys()):
         print " * [#{0}] {1}".format(ticket, summaries[ticket])
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/scripts/create-allura-sitemap.py
----------------------------------------------------------------------
diff --git a/scripts/create-allura-sitemap.py b/scripts/create-allura-sitemap.py
index 13222c1..5357df7 100644
--- a/scripts/create-allura-sitemap.py
+++ b/scripts/create-allura-sitemap.py
@@ -28,11 +28,13 @@ things that would make it faster, if we need/want to.
 2. Use multiprocessing to distribute the offsets to n subprocesses.
 """
 
-import os, sys
+import os
+import sys
 from datetime import datetime
 from jinja2 import Template
 
-import pylons, webob
+import pylons
+import webob
 from pylons import tmpl_context as c
 
 from allura import model as M
@@ -67,6 +69,7 @@ SITEMAP_TEMPLATE = """\
 </urlset>
 """
 
+
 def main(options, args):
     # This script will indirectly call app.sidebar_menu() for every app in
     # every project. Some of the sidebar_menu methods expect the
@@ -86,6 +89,7 @@ def main(options, args):
 
     now = datetime.utcnow().date()
     sitemap_content_template = Template(SITEMAP_TEMPLATE)
+
     def write_sitemap(urls, file_no):
         sitemap_content = sitemap_content_template.render(dict(
             now=now, locs=urls))
@@ -101,7 +105,7 @@ def main(options, args):
             c.project = p
             try:
                 locs += [BASE_URL + s.url if s.url[0] == '/' else s.url
-                        for s in p.sitemap(excluded_tools=['git', 'hg', 'svn'])]
+                         for s in p.sitemap(excluded_tools=['git', 'hg', 'svn'])]
             except Exception, e:
                 print "Error creating sitemap for project '%s': %s" %\
                     (p.shortname, e)
@@ -120,13 +124,15 @@ def main(options, args):
     if file_count:
         sitemap_index_vars = dict(
             now=now,
-            sitemaps = [
+            sitemaps=[
                 '%s/allura_sitemap/sitemap-%d.xml' % (BASE_URL, n)
                 for n in range(file_count)])
-        sitemap_index_content = Template(INDEX_TEMPLATE).render(sitemap_index_vars)
+        sitemap_index_content = Template(
+            INDEX_TEMPLATE).render(sitemap_index_vars)
         with open(os.path.join(output_path, 'sitemap.xml'), 'w') as f:
             f.write(sitemap_index_content)
 
+
 def parse_options():
     def validate(option, opt_str, value, parser):
         parser.values.urls_per_file = min(value, MAX_SITEMAP_URLS)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/scripts/git-hooks/for-the-remote-repo/update
----------------------------------------------------------------------
diff --git a/scripts/git-hooks/for-the-remote-repo/update b/scripts/git-hooks/for-the-remote-repo/update
index 15c1c21..b2dcc6b 100755
--- a/scripts/git-hooks/for-the-remote-repo/update
+++ b/scripts/git-hooks/for-the-remote-repo/update
@@ -17,7 +17,10 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
-import os, re, sys, subprocess
+import os
+import re
+import sys
+import subprocess
 
 signoff = re.compile('^Signed-off-by: ', flags=re.MULTILINE)
 parent = re.compile('^parent ', flags=re.MULTILINE)
@@ -25,7 +28,8 @@ no_commit = '0' * 40
 
 
 def run(*args):
-    p = subprocess.Popen(list(args), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+    p = subprocess.Popen(list(args), stdout=subprocess.PIPE,
+                         stderr=subprocess.STDOUT)
     p.wait()
     return p.stdout.readlines()
 
@@ -45,16 +49,17 @@ def git_user():
 
 
 def unwrap_commit_ids(git_output):
-    return [ commit_id[:-1] for commit_id in git_output ]
+    return [commit_id[:-1] for commit_id in git_output]
 
 
 def all_commits_signed_off(from_rev, to_rev):
-    commits = unwrap_commit_ids(run('git', 'rev-list', '%s..%s' % (from_rev, to_rev)))
+    commits = unwrap_commit_ids(
+        run('git', 'rev-list', '%s..%s' % (from_rev, to_rev)))
     for commit in commits:
         raw_commit = ''.join(run('git', 'cat-file', '-p', commit))
         headers, body = raw_commit.split('\n\n', 1)
         num_parents = len(parent.findall(headers))
-        if num_parents<2 and not signoff.search(body):
+        if num_parents < 2 and not signoff.search(body):
             return False
     return True
 
@@ -66,31 +71,44 @@ def deny_update(message):
 
 def main():
     ref_name = sys.argv[1]  # the branch being updated, e.g., refs/heads/master
-    old_rev = sys.argv[2]   # the pre-update commit-id of that branch (or '0'*40 if we're creating the branch)
-    new_rev = sys.argv[3]   # the post-update commit-id of that branch (or '0'*40 if we're deleting the branch)
+    # the pre-update commit-id of that branch (or '0'*40 if we're creating the
+    # branch)
+    old_rev = sys.argv[2]
+    # the post-update commit-id of that branch (or '0'*40 if we're deleting
+    # the branch)
+    new_rev = sys.argv[3]
 
     (user_name, user_prefix) = git_user()
 
     if old_rev == no_commit:
         action = 'create'
-        merge_base = unwrap_commit_ids(run('git', 'merge-base', 'master', new_rev))[0]
-            # not ideal, since you probably branched off something more specific than master
+        merge_base = unwrap_commit_ids(
+            run('git', 'merge-base', 'master', new_rev))[0]
+            # not ideal, since you probably branched off something more
+            # specific than master
     elif new_rev == no_commit:
         action = 'destroy'
     else:
         action = 'update'
-        merge_base = unwrap_commit_ids(run('git', 'merge-base', old_rev, new_rev))[0]
+        merge_base = unwrap_commit_ids(
+            run('git', 'merge-base', old_rev, new_rev))[0]
 
     if ref_name.startswith('refs/heads/%s/' % user_prefix) or ref_name.startswith('refs/heads/ffa/') or user_name == 'wolf' or user_name == 'dbrondsema':
-        pass # no restrictions
+        pass  # no restrictions
     elif ref_name.startswith('refs/heads/'):
         substitutions = (user_name, ref_name, 'refs/heads/%s/*' % user_prefix)
         if action == 'create':
-            deny_update("You (%s) may not create '%s'; you have full rights over '%s'." % substitutions)
+            deny_update(
+                "You (%s) may not create '%s'; you have full rights over '%s'." %
+                substitutions)
         elif action == 'destroy':
-            deny_update("You (%s) may not destroy '%s'; you have full rights over '%s'." % substitutions)
+            deny_update(
+                "You (%s) may not destroy '%s'; you have full rights over '%s'." %
+                substitutions)
         elif old_rev != merge_base:
-            deny_update("You (%s) may not rewind or rebase '%s'; you have full rights over '%s'." % substitutions)
+            deny_update(
+                "You (%s) may not rewind or rebase '%s'; you have full rights over '%s'." %
+                substitutions)
 
     if ref_name.startswith('refs/heads/') and action != 'destroy' and not all_commits_signed_off(merge_base, new_rev):
         deny_update('Not all commits were signed-off.')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/scripts/git-hooks/for-your-local-repo/commit-msg
----------------------------------------------------------------------
diff --git a/scripts/git-hooks/for-your-local-repo/commit-msg b/scripts/git-hooks/for-your-local-repo/commit-msg
index e65d571..96d375b 100755
--- a/scripts/git-hooks/for-your-local-repo/commit-msg
+++ b/scripts/git-hooks/for-your-local-repo/commit-msg
@@ -17,15 +17,18 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
-import re, sys
+import re
+import sys
 
 signoff = re.compile('^Signed-off-by: (.*)$', flags=re.MULTILINE)
 bug = re.compile('\[(?:.*:)?#\d+\]')
 
+
 def deny_commit(message):
     print message
     sys.exit(1)
 
+
 def main():
     # argv[1] is the name of the file holding the commit message.
     # It is _not_ a commit, it has no headers.  The first line is

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/scripts/git-mr
----------------------------------------------------------------------
diff --git a/scripts/git-mr b/scripts/git-mr
index 5da0491..3e4916e 100755
--- a/scripts/git-mr
+++ b/scripts/git-mr
@@ -38,7 +38,7 @@ usage = "git mr [-a|-r] [--grep PATTERN] [upstream]"
 
 def main():
     parser = argparse.ArgumentParser(prog='git mr', usage=usage)
-    parser.add_argument('-r', action='store_true', 
+    parser.add_argument('-r', action='store_true',
                         dest='examine_remote_branches', default=False,
                         help='examine remote branches')
     parser.add_argument('-a', action='store_true',
@@ -60,49 +60,52 @@ def main():
         merged_branches = git('branch', '--merged', args.upstream)
         unmerged_branches = git('branch', '--no-merged', args.upstream)
 
-    merged_branches = [ line[2:] for line in merged_branches ]
-    unmerged_branches = [ line[2:] for line in unmerged_branches ]
+    merged_branches = [line[2:] for line in merged_branches]
+    unmerged_branches = [line[2:] for line in unmerged_branches]
     really_unmerged_branches = []
 
     if args.grep:
         filter = re.compile(args.grep[0])
-        merged_branches = [ b for b in merged_branches if filter.search(b) ]
-        unmerged_branches = [ b for b in unmerged_branches if filter.search(b) ]
+        merged_branches = [b for b in merged_branches if filter.search(b)]
+        unmerged_branches = [b for b in unmerged_branches if filter.search(b)]
 
     if merged_branches:
         print('Branches contained by %s:' % args.upstream)
         for branch in merged_branches:
-            print('  '+colorize('green', branch))
+            print('  ' + colorize('green', branch))
 
     if unmerged_branches:
         header_printed = False
         for branch in unmerged_branches:
-            commits = ''.join(git('cherry', args.upstream, branch, strip_eol=False))
+            commits = ''.join(
+                git('cherry', args.upstream, branch, strip_eol=False))
             if commits.find('+') == -1:
                 if not header_printed:
                     print('Branches probably merged to %s:' % args.upstream)
                     header_printed = True
-                print('  '+colorize('green', branch))
+                print('  ' + colorize('green', branch))
             else:
-                really_unmerged_branches += [ branch ]
+                really_unmerged_branches += [branch]
 
         if really_unmerged_branches:
             print('Branches probably not merged to %s:' % args.upstream)
             for branch in really_unmerged_branches:
-                print('  '+colorize('red', branch))
+                print('  ' + colorize('red', branch))
+
 
 def git(*args, **kw):
-    if len(args)==1 and isinstance(args[0], basestring):
+    if len(args) == 1 and isinstance(args[0], basestring):
         argv = shlex.split(args[0])
     else:
         argv = list(args)
     if argv[0] != 'git':
         argv.insert(0, 'git')
-    p = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+    p = subprocess.Popen(argv, stdout=subprocess.PIPE,
+                         stderr=subprocess.STDOUT)
     rc = p.wait()
     output = p.stdout.readlines()
     if kw.get('strip_eol', True):
-        output = [ line.rstrip('\n') for line in output ]
+        output = [line.rstrip('\n') for line in output]
     return output
 
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/scripts/import_trove_categories.py
----------------------------------------------------------------------
diff --git a/scripts/import_trove_categories.py b/scripts/import_trove_categories.py
index 86d2063..123a56c 100644
--- a/scripts/import_trove_categories.py
+++ b/scripts/import_trove_categories.py
@@ -28,15 +28,18 @@ from sfx.model import tables as T
 
 log = logging.getLogger(__name__)
 
+
 def main():
     sfx.middleware.configure_databases(h.config_with_prefix(config, 'sfx.'))
-    topic_trove = T.trove_cat.select(T.trove_cat.c.shortname=='topic').execute().fetchone()
+    topic_trove = T.trove_cat.select(
+        T.trove_cat.c.shortname == 'topic').execute().fetchone()
     M.ProjectCategory.query.remove()
     for t in T.trove_cat.select(
-        T.trove_cat.c.parent==topic_trove.trove_cat_id).execute():
-        parent = M.ProjectCategory(name=t.shortname, label=t.fullname, description=t.description)
+            T.trove_cat.c.parent == topic_trove.trove_cat_id).execute():
+        parent = M.ProjectCategory(
+            name=t.shortname, label=t.fullname, description=t.description)
         for tt in T.trove_cat.select(
-            T.trove_cat.c.parent==t.trove_cat_id).execute():
+                T.trove_cat.c.parent == t.trove_cat_id).execute():
             M.ProjectCategory(parent_id=parent._id,
                               name=tt.shortname, label=tt.fullname, description=tt.description)
     session(M.ProjectCategory).flush()