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:23:26 UTC

[30/36] PEP8 cleanup

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/command/reclone_repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/reclone_repo.py b/Allura/allura/command/reclone_repo.py
index 5ab8e3f..7cc06a5 100644
--- a/Allura/allura/command/reclone_repo.py
+++ b/Allura/allura/command/reclone_repo.py
@@ -26,8 +26,8 @@ from . import base
 
 
 class RecloneRepoCommand(base.Command):
-    min_args=3
-    max_args=None
+    min_args = 3
+    max_args = None
     usage = '<ini file> [-n nbhd] <project_shortname> <mount_point>'
     summary = 'Reinitialize a repo from the original clone source'
     parser = base.Command.standard_parser(verbose=True)
@@ -55,11 +55,13 @@ class RecloneRepoCommand(base.Command):
         c.user = M.User.query.get(username='sfrobot')
         nbhd = M.Neighborhood.query.get(url_prefix='/%s/' % self.options.nbhd)
         assert nbhd, 'Neighborhood with prefix %s not found' % self.options.nbhd
-        c.project = M.Project.query.get(shortname=self.args[1], neighborhood_id=nbhd._id)
-        assert c.project, 'Project with shortname %s not found in neighborhood %s' % (self.args[1], nbhd.name)
+        c.project = M.Project.query.get(
+            shortname=self.args[1], neighborhood_id=nbhd._id)
+        assert c.project, 'Project with shortname %s not found in neighborhood %s' % (
+            self.args[1], nbhd.name)
         c.app = c.project.app_instance(self.args[2])
-        assert c.app, 'Mount point %s not found on project %s' % (self.args[2], c.project.shortname)
-
+        assert c.app, 'Mount point %s not found on project %s' % (
+            self.args[2], c.project.shortname)
 
     def _clone_repo(self):
         '''Initiate the repo clone.'''

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/command/script.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/script.py b/Allura/allura/command/script.py
index 8c124b5..1f2c93a 100644
--- a/Allura/allura/command/script.py
+++ b/Allura/allura/command/script.py
@@ -29,9 +29,10 @@ from allura.lib import helpers as h
 from allura.lib import utils
 from . import base
 
+
 class ScriptCommand(base.Command):
-    min_args=2
-    max_args=None
+    min_args = 2
+    max_args = None
     usage = '<ini file> <script> ...'
     summary = 'Run a script as if it were being run at the paster shell prompt'
     parser = base.Command.standard_parser(verbose=True)
@@ -50,7 +51,7 @@ class ScriptCommand(base.Command):
                 warnings.simplefilter("ignore", category=exc.SAWarning)
             self.basic_setup()
             request = webob.Request.blank('--script--', environ={
-                    'paste.registry':self.registry})
+                'paste.registry': self.registry})
             self.registry.register(pylons.request, request)
             if self.options.pdb:
                 base.log.info('Installing exception hook')
@@ -59,13 +60,15 @@ class ScriptCommand(base.Command):
                 ns = dict(__name__='__main__')
                 sys.argv = self.args[1:]
                 if self.options.profile:
-                    cProfile.run(fp, '%s.profile' % os.path.basename(self.args[1]))
+                    cProfile.run(fp, '%s.profile' %
+                                 os.path.basename(self.args[1]))
                 else:
                     exec fp in ns
 
+
 class SetToolAccessCommand(base.Command):
-    min_args=3
-    max_args=None
+    min_args = 3
+    max_args = None
     usage = '<ini file> <project_shortname> <neighborhood_name> <access_level>...'
     summary = ('Set the tool statuses that are permitted to be installed on a'
                ' given project')
@@ -77,7 +80,7 @@ class SetToolAccessCommand(base.Command):
         extra_status = []
         for s in self.args[3:]:
             s = s.lower()
-            if s=='production':
+            if s == 'production':
                 print ('All projects always have access to prodcution tools,'
                        ' so removing from list.')
                 continue

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/command/set_neighborhood_features.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/set_neighborhood_features.py b/Allura/allura/command/set_neighborhood_features.py
index 53469c0..c4de43c 100644
--- a/Allura/allura/command/set_neighborhood_features.py
+++ b/Allura/allura/command/set_neighborhood_features.py
@@ -25,7 +25,10 @@ from allura.lib import plugin, exceptions
 from ming.orm import session
 
 # Example usage:
-# paster set-neighborhood-features development.ini 4f50c898610b270c92000286 max_projects 50
+# paster set-neighborhood-features development.ini
+# 4f50c898610b270c92000286 max_projects 50
+
+
 class SetNeighborhoodFeaturesCommand(base.Command):
     min_args = 4
     max_args = 4
@@ -50,40 +53,40 @@ class SetNeighborhoodFeaturesCommand(base.Command):
         except ValueError:
             n_value = self.args[3]
         if n_feature not in ["max_projects", "css", "google_analytics", "private_projects"]:
-            raise exceptions.NoSuchNBFeatureError("%s is not a valid " \
-                "neighborhood feature. The valid features are \"max_projects\", " \
-                "\"css\", \"google_analytics\" and \"private_projects\"" % n_feature)
+            raise exceptions.NoSuchNBFeatureError("%s is not a valid "
+                                                  "neighborhood feature. The valid features are \"max_projects\", "
+                                                  "\"css\", \"google_analytics\" and \"private_projects\"" % n_feature)
 
         n = M.Neighborhood.query.get(name=n_id)
         if not n:
             n = M.Neighborhood.query.get(_id=ObjectId(n_id))
 
         if not n:
-            raise exceptions.NoSuchNeighborhoodError("The neighborhood %s " \
-                "could not be found in the database" % n_id)
+            raise exceptions.NoSuchNeighborhoodError("The neighborhood %s "
+                                                     "could not be found in the database" % n_id)
         else:
             if n_feature == "max_projects":
                 if isinstance(n_value, int) or n_value is None:
                     n.features['max_projects'] = n_value
                 else:
-                    raise exceptions.InvalidNBFeatureValueError("max_projects must be " \
-                        "an int or None.")
+                    raise exceptions.InvalidNBFeatureValueError("max_projects must be "
+                                                                "an int or None.")
             elif n_feature == "css":
                 if n_value in ['none', 'custom', 'picker']:
                     n.features['css'] = n_value
                 else:
-                    raise exceptions.InvalidNBFeatureValueError("css must be " \
-                        "'none', 'custom', or 'picker'")
+                    raise exceptions.InvalidNBFeatureValueError("css must be "
+                                                                "'none', 'custom', or 'picker'")
             elif n_feature == "google_analytics":
                 if isinstance(n_value, bool):
                     n.features['google_analytics'] = n_value
                 else:
-                    raise exceptions.InvalidNBFeatureValueError("google_analytics must be " \
-                        "a boolean")
+                    raise exceptions.InvalidNBFeatureValueError("google_analytics must be "
+                                                                "a boolean")
             else:
                 if isinstance(n_value, bool):
                     n.features['private_projects'] = n_value
                 else:
-                    raise exceptions.InvalidNBFeatureValueError("private_projects must be " \
-                        "a boolean")
+                    raise exceptions.InvalidNBFeatureValueError("private_projects must be "
+                                                                "a boolean")
             session(M.Neighborhood).flush()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/command/show_models.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/show_models.py b/Allura/allura/command/show_models.py
index f4d2784..76d95ac 100644
--- a/Allura/allura/command/show_models.py
+++ b/Allura/allura/command/show_models.py
@@ -35,8 +35,8 @@ from . import base
 
 
 class ShowModelsCommand(base.Command):
-    min_args=1
-    max_args=1
+    min_args = 1
+    max_args = 1
     usage = '<ini file>'
     summary = 'Show the inheritance graph of all Ming models'
     parser = base.Command.standard_parser(verbose=True)
@@ -50,8 +50,8 @@ class ShowModelsCommand(base.Command):
 
 
 class ReindexCommand(base.Command):
-    min_args=1
-    max_args=1
+    min_args = 1
+    max_args = 1
     usage = '<ini file>'
     summary = 'Reindex and re-shortlink all artifacts'
     parser = base.Command.standard_parser(verbose=True)
@@ -60,13 +60,15 @@ class ReindexCommand(base.Command):
     parser.add_option('--project-regex', dest='project_regex', default='',
                       help='Restrict reindex to projects for which the shortname matches '
                       'the provided regex.')
-    parser.add_option('-n', '--neighborhood', dest='neighborhood', default=None,
-                      help='neighborhood to reindex (e.g. p)')
+    parser.add_option(
+        '-n', '--neighborhood', dest='neighborhood', default=None,
+        help='neighborhood to reindex (e.g. p)')
 
     parser.add_option('--solr', action='store_true', dest='solr',
                       help='Solr needs artifact references to already exist.')
-    parser.add_option('--skip-solr-delete', action='store_true', dest='skip_solr_delete',
-                      help='Skip clearing solr index.')
+    parser.add_option(
+        '--skip-solr-delete', action='store_true', dest='skip_solr_delete',
+        help='Skip clearing solr index.')
     parser.add_option('--refs', action='store_true', dest='refs',
                       help='Update artifact references and shortlinks')
     parser.add_option('--tasks', action='store_true', dest='tasks',
@@ -75,10 +77,11 @@ class ReindexCommand(base.Command):
                            'which are needed for some markdown macros to run properly')
     parser.add_option('--solr-hosts', dest='solr_hosts',
                       help='Override the solr host(s) to post to.  Comma-separated list of solr server URLs')
-    parser.add_option('--max-chunk', dest='max_chunk', type=int, default=100*1000,
-                      help='Max number of artifacts to index in one Solr update command')
+    parser.add_option(
+        '--max-chunk', dest='max_chunk', type=int, default=100 * 1000,
+        help='Max number of artifacts to index in one Solr update command')
     parser.add_option('--ming-config', dest='ming_config', help='Path (absolute, or relative to '
-                        'Allura root) to .ini file defining ming configuration.')
+                      'Allura root) to .ini file defining ming configuration.')
 
     def command(self):
         from allura import model as M
@@ -107,9 +110,10 @@ class ReindexCommand(base.Command):
                 if self.options.solr and not self.options.skip_solr_delete:
                     g.solr.delete(q='project_id_s:%s' % p._id)
                 if self.options.refs:
-                    M.ArtifactReference.query.remove({'artifact_reference.project_id':p._id})
-                    M.Shortlink.query.remove({'project_id':p._id})
-                app_config_ids = [ ac._id for ac in p.app_configs ]
+                    M.ArtifactReference.query.remove(
+                        {'artifact_reference.project_id': p._id})
+                    M.Shortlink.query.remove({'project_id': p._id})
+                app_config_ids = [ac._id for ac in p.app_configs]
                 # Traverse the inheritance graph, finding all artifacts that
                 # belong to this project
                 for _, a_cls in dfs(M.Artifact, graph):
@@ -124,7 +128,8 @@ class ReindexCommand(base.Command):
                                 M.ArtifactReference.from_artifact(a)
                                 M.Shortlink.from_artifact(a)
                             except:
-                                base.log.exception('Making ArtifactReference/Shortlink from %s', a)
+                                base.log.exception(
+                                    'Making ArtifactReference/Shortlink from %s', a)
                                 continue
                         ref_ids.append(a.index_id())
                     M.main_orm_session.flush()
@@ -132,7 +137,8 @@ class ReindexCommand(base.Command):
                     try:
                         self._chunked_add_artifacts(ref_ids)
                     except CompoundError, err:
-                        base.log.exception('Error indexing artifacts:\n%r', err)
+                        base.log.exception(
+                            'Error indexing artifacts:\n%r', err)
                         base.log.error('%s', err.format_error())
                     M.main_orm_session.flush()
                     M.main_orm_session.clear()
@@ -141,7 +147,7 @@ class ReindexCommand(base.Command):
     @property
     def add_artifact_kwargs(self):
         if self.options.solr_hosts:
-           return {'solr_hosts': self.options.solr_hosts.split(',')}
+            return {'solr_hosts': self.options.solr_hosts.split(',')}
         return {}
 
     def _chunked_add_artifacts(self, ref_ids):
@@ -169,7 +175,8 @@ class ReindexCommand(base.Command):
                                    update_refs=self.options.refs,
                                    **self.add_artifact_kwargs)
         except InvalidDocument as e:
-            # there are many types of InvalidDocument, only recurse if its expected to help
+            # there are many types of InvalidDocument, only recurse if its
+            # expected to help
             if str(e).startswith('BSON document too large'):
                 self._post_add_artifacts(chunk[:len(chunk) // 2])
                 self._post_add_artifacts(chunk[len(chunk) // 2:])
@@ -193,8 +200,8 @@ class ReindexCommand(base.Command):
 
 
 class EnsureIndexCommand(base.Command):
-    min_args=1
-    max_args=1
+    min_args = 1
+    max_args = 1
     usage = '[<ini file>]'
     summary = 'Run ensure_index on all mongo objects'
     parser = base.Command.standard_parser(verbose=True)
@@ -202,12 +209,13 @@ class EnsureIndexCommand(base.Command):
     def command(self):
         from allura import model as M
         main_session_classes = [M.main_orm_session, M.repository_orm_session,
-                M.task_orm_session]
+                                M.task_orm_session]
         if asbool(self.config.get('activitystream.recording.enabled', False)):
             from activitystream.storage.mingstorage import activity_orm_session
             main_session_classes.append(activity_orm_session)
         self.basic_setup()
-        main_indexes = defaultdict(lambda: defaultdict(list))  # by db, then collection name
+        # by db, then collection name
+        main_indexes = defaultdict(lambda: defaultdict(list))
         project_indexes = defaultdict(list)  # by collection name
         base.log.info('Collecting indexes...')
         for m in Mapper.all_mappers():
@@ -237,7 +245,8 @@ class EnsureIndexCommand(base.Command):
 
     def _update_indexes(self, collection, indexes):
         uindexes = dict(
-            (tuple(i.index_spec), i)  # convert list to tuple so it's hashable for 'set'
+            # convert list to tuple so it's hashable for 'set'
+            (tuple(i.index_spec), i)
             for i in indexes
             if i.unique)
         indexes = dict(
@@ -284,30 +293,36 @@ class EnsureIndexCommand(base.Command):
         # Drop obsolete indexes
         for iname, keys in prev_indexes.iteritems():
             if keys not in indexes:
-                base.log.info('...... drop index %s:%s', collection.name, iname)
+                base.log.info('...... drop index %s:%s',
+                              collection.name, iname)
                 collection.drop_index(iname)
         for iname, keys in prev_uindexes.iteritems():
             if keys not in uindexes:
-                base.log.info('...... drop index %s:%s', collection.name, iname)
+                base.log.info('...... drop index %s:%s',
+                              collection.name, iname)
                 collection.drop_index(iname)
 
     def _recreate_index(self, collection, iname, keys, **creation_options):
         '''Recreate an index with new creation options, using a temporary index
         so that at no time is an index missing from the specified keys'''
         superset_keys = keys + [('temporary_extra_field_for_indexing', 1)]
-        base.log.info('...... ensure index %s:%s', collection.name, superset_keys)
+        base.log.info('...... ensure index %s:%s',
+                      collection.name, superset_keys)
         superset_index = collection.ensure_index(superset_keys)
         base.log.info('...... drop index %s:%s', collection.name, iname)
         collection.drop_index(iname)
-        base.log.info('...... ensure index %s:%s %s', collection.name, keys, creation_options)
+        base.log.info('...... ensure index %s:%s %s',
+                      collection.name, keys, creation_options)
         collection.ensure_index(keys, **creation_options)
-        base.log.info('...... drop index %s:%s', collection.name, superset_index)
+        base.log.info('...... drop index %s:%s',
+                      collection.name, superset_index)
         collection.drop_index(superset_index)
 
     def _remove_dupes(self, collection, spec):
         iname = collection.create_index(spec)
-        fields = [ f[0] for f in spec ]
+        fields = [f[0] for f in spec]
         q = collection.find({}, fields=fields).sort(spec)
+
         def keyfunc(doc):
             return tuple(doc.get(f, None) for f in fields)
         dupes = []
@@ -315,47 +330,53 @@ class EnsureIndexCommand(base.Command):
             docs = list(doc_iter)
             if len(docs) > 1:
                 base.log.info('Found dupes with %s', key)
-                dupes += [ doc['_id'] for doc in docs[1:] ]
+                dupes += [doc['_id'] for doc in docs[1:]]
         collection.drop_index(iname)
-        collection.remove(dict(_id={'$in':dupes}))
+        collection.remove(dict(_id={'$in': dupes}))
+
 
 def build_model_inheritance_graph():
     graph = dict((m.mapped_class, ([], [])) for m in Mapper.all_mappers())
-    for cls, (parents, children)  in graph.iteritems():
+    for cls, (parents, children) in graph.iteritems():
         for b in cls.__bases__:
-            if b not in graph: continue
+            if b not in graph:
+                continue
             parents.append(b)
             graph[b][1].append(cls)
     return graph
 
+
 def dump_cls(depth, cls):
-    indent = ' '*4*depth
+    indent = ' ' * 4 * depth
     yield indent + '%s.%s' % (cls.__module__, cls.__name__)
     m = mapper(cls)
     for p in m.properties:
-        s = indent*2 + ' - ' + str(p)
+        s = indent * 2 + ' - ' + str(p)
         if hasattr(p, 'field_type'):
             s += ' (%s)' % p.field_type
         yield s
 
+
 def dfs(root, graph, depth=0):
     yield depth, root
     for c in graph[root][1]:
-        for r in dfs(c, graph, depth+1):
+        for r in dfs(c, graph, depth + 1):
             yield r
 
 
-def pm(etype, value, tb): # pragma no cover
-    import pdb, traceback
+def pm(etype, value, tb):  # pragma no cover
+    import pdb
+    import traceback
     try:
-        from IPython.ipapi import make_session; make_session()
+        from IPython.ipapi import make_session
+        make_session()
         from IPython.Debugger import Pdb
         sys.stderr.write('Entering post-mortem IPDB shell\n')
         p = Pdb(color_scheme='Linux')
         p.reset()
         p.setup(None, tb)
         p.print_stack_trace()
-        sys.stderr.write('%s: %s\n' % ( etype, value))
+        sys.stderr.write('%s: %s\n' % (etype, value))
         p.cmdloop()
         p.forget()
         # p.interaction(None, tb)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/command/smtp_server.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/smtp_server.py b/Allura/allura/command/smtp_server.py
index ca26cb4..b113072 100644
--- a/Allura/allura/command/smtp_server.py
+++ b/Allura/allura/command/smtp_server.py
@@ -27,9 +27,10 @@ from allura.command import base
 
 from paste.deploy.converters import asint
 
+
 class SMTPServerCommand(base.Command):
-    min_args=1
-    max_args=1
+    min_args = 1
+    max_args = 1
     usage = '<ini file>'
     summary = 'Handle incoming emails, routing them to RabbitMQ'
     parser = command.Command.standard_parser(verbose=True)
@@ -45,6 +46,7 @@ class SMTPServerCommand(base.Command):
                    None)
         asyncore.loop()
 
+
 class MailServer(smtpd.SMTPServer):
 
     def process_message(self, peer, mailfrom, rcpttos, data):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/command/taskd.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/taskd.py b/Allura/allura/command/taskd.py
index 94c6221..f05a4b3 100644
--- a/Allura/allura/command/taskd.py
+++ b/Allura/allura/command/taskd.py
@@ -40,6 +40,7 @@ status_log = logging.getLogger('taskdstatus')
 
 log = logging.getLogger(__name__)
 
+
 @contextmanager
 def proctitle(title):
     """Temporarily change the process title, then restore it."""
@@ -77,23 +78,29 @@ class TaskdCommand(base.Command):
         self.worker()
 
     def graceful_restart(self, signum, frame):
-        base.log.info('taskd pid %s recieved signal %s preparing to do a graceful restart' % (os.getpid(), signum))
+        base.log.info(
+            'taskd pid %s recieved signal %s preparing to do a graceful restart' %
+            (os.getpid(), signum))
         self.keep_running = False
         self.restart_when_done = True
 
     def graceful_stop(self, signum, frame):
-        base.log.info('taskd pid %s recieved signal %s preparing to do a graceful stop' % (os.getpid(), signum))
+        base.log.info(
+            'taskd pid %s recieved signal %s preparing to do a graceful stop' %
+            (os.getpid(), signum))
         self.keep_running = False
 
     def log_current_task(self, signum, frame):
-        entry = 'taskd pid %s is currently handling task %s' % (os.getpid(), getattr(self, 'task', None))
+        entry = 'taskd pid %s is currently handling task %s' % (
+            os.getpid(), getattr(self, 'task', None))
         status_log.info(entry)
         base.log.info(entry)
 
     def worker(self):
         from allura import model as M
         name = '%s pid %s' % (os.uname()[1], os.getpid())
-        wsgi_app = loadapp('config:%s#task' % self.args[0],relative_to=os.getcwd())
+        wsgi_app = loadapp('config:%s#task' %
+                           self.args[0], relative_to=os.getcwd())
         poll_interval = asint(pylons.config.get('monq.poll_interval', 10))
         only = self.options.only
         if only:
@@ -101,8 +108,9 @@ class TaskdCommand(base.Command):
 
         def start_response(status, headers, exc_info=None):
             if status != '200 OK':
-                log.warn('Unexpected http response from taskd request: %s.  Headers: %s',
-                             status, headers)
+                log.warn(
+                    'Unexpected http response from taskd request: %s.  Headers: %s',
+                    status, headers)
 
         def waitfunc_amqp():
             try:
@@ -132,23 +140,26 @@ class TaskdCommand(base.Command):
             try:
                 while self.keep_running:
                     self.task = M.MonQTask.get(
-                            process=name,
-                            waitfunc=waitfunc,
-                            only=only)
+                        process=name,
+                        waitfunc=waitfunc,
+                        only=only)
                     if self.task:
                         with(proctitle("taskd:{0}:{1}".format(
                                 self.task.task_name, self.task._id))):
                             # Build the (fake) request
-                            request_path = '/--%s--/%s/' % (self.task.task_name, self.task._id)
+                            request_path = '/--%s--/%s/' % (self.task.task_name,
+                                                            self.task._id)
                             r = Request.blank(request_path,
-                                              base_url=tg.config['base_url'].rstrip('/') + request_path,
+                                              base_url=tg.config['base_url'].rstrip(
+                                                  '/') + request_path,
                                               environ={'task': self.task,
-                                               })
+                                                       })
                             list(wsgi_app(r.environ, start_response))
                             self.task = None
             except Exception as e:
                 if self.keep_running:
-                    base.log.exception('taskd error %s; pausing for 10s before taking more tasks' % e)
+                    base.log.exception(
+                        'taskd error %s; pausing for 10s before taking more tasks' % e)
                     time.sleep(10)
                 else:
                     base.log.exception('taskd error %s' % e)
@@ -211,7 +222,8 @@ class TaskCommand(base.Command):
     def _timeout(self):
         '''Reset tasks that have been busy too long to 'ready' state'''
         from allura import model as M
-        base.log.info('Reset tasks stuck for %ss or more', self.options.timeout)
+        base.log.info('Reset tasks stuck for %ss or more',
+                      self.options.timeout)
         cutoff = datetime.utcnow() - timedelta(seconds=self.options.timeout)
         M.MonQTask.timeout_tasks(cutoff)
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/command/taskd_cleanup.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/taskd_cleanup.py b/Allura/allura/command/taskd_cleanup.py
index 3652758..517917f 100644
--- a/Allura/allura/command/taskd_cleanup.py
+++ b/Allura/allura/command/taskd_cleanup.py
@@ -25,16 +25,17 @@ from ming.orm.ormsession import ThreadLocalORMSession
 from allura import model as M
 import base
 
+
 class TaskdCleanupCommand(base.Command):
     summary = 'Tasks cleanup command'
     parser = base.Command.standard_parser(verbose=True)
     parser.add_option('-k', '--kill-stuck-taskd',
-            dest='kill', action='store_true',
-            help='automatically kill stuck taskd processes.  Be careful with this, a taskd process '
-                 'may just be very busy on certain operations and not able to respond to our status request')
+                      dest='kill', action='store_true',
+                      help='automatically kill stuck taskd processes.  Be careful with this, a taskd process '
+                      'may just be very busy on certain operations and not able to respond to our status request')
     parser.add_option('-n', '--num-retry-status-check',
-            dest='num_retry', type='int', default=5,
-            help='number of retries to read taskd status log after sending USR1 signal (5 by default)')
+                      dest='num_retry', type='int', default=5,
+                      help='number of retries to read taskd status log after sending USR1 signal (5 by default)')
     usage = '<ini file> [-k] <taskd status log file>'
     min_args = 2
     max_args = 2
@@ -48,12 +49,14 @@ class TaskdCleanupCommand(base.Command):
         self.suspicious_tasks = []
 
         taskd_pids = self._taskd_pids()
-        base.log.info('Taskd processes on %s: %s' % (self.hostname, taskd_pids))
+        base.log.info('Taskd processes on %s: %s' %
+                      (self.hostname, taskd_pids))
 
         # find stuck taskd processes
         base.log.info('Seeking for stuck taskd processes')
         for pid in taskd_pids:
-            base.log.info('...sending USR1 to %s and watching status log' % (pid))
+            base.log.info('...sending USR1 to %s and watching status log' %
+                          (pid))
             status = self._check_taskd_status(int(pid))
             if status != 'OK':
                 base.log.info('...taskd pid %s has stuck' % pid)
@@ -68,21 +71,25 @@ class TaskdCleanupCommand(base.Command):
         base.log.info('Seeking for forsaken busy tasks')
         tasks = [t for t in self._busy_tasks()
                  if t not in self.error_tasks]  # skip seen tasks
-        base.log.info('Found %s busy tasks on %s' % (len(tasks), self.hostname))
+        base.log.info('Found %s busy tasks on %s' %
+                      (len(tasks), self.hostname))
         for task in tasks:
             base.log.info('Verifying task %s' % task)
             pid = task.process.split()[-1]
             if pid not in taskd_pids:
                 # 'forsaken' task
                 base.log.info('Task is forsaken '
-                    '(can\'t find taskd with given pid). '
-                    'Setting state to \'error\'')
+                              '(can\'t find taskd with given pid). '
+                              'Setting state to \'error\'')
                 task.state = 'error'
                 task.result = 'Can\'t find taskd with given pid'
                 self.error_tasks.append(task)
             else:
-                # check if taskd with given pid really processing this task now:
-                base.log.info('Checking that taskd pid %s is really processing task %s' % (pid, task._id))
+                # check if taskd with given pid really processing this task
+                # now:
+                base.log.info(
+                    'Checking that taskd pid %s is really processing task %s' %
+                    (pid, task._id))
                 status = self._check_task(pid, task)
                 if status != 'OK':
                     # maybe task moved quickly and now is complete
@@ -106,7 +113,8 @@ class TaskdCleanupCommand(base.Command):
             if self.options.kill:
                 base.log.info('...stuck taskd processes were killed')
             else:
-                base.log.info('...to kill these processes run command with -k flag if you are sure they are really stuck')
+                base.log.info(
+                    '...to kill these processes run command with -k flag if you are sure they are really stuck')
         if self.error_tasks:
             base.log.info('Tasks marked as \'error\': %s' % self.error_tasks)
 
@@ -122,8 +130,8 @@ class TaskdCleanupCommand(base.Command):
     def _taskd_pids(self):
         # space after "taskd" to ensure no match on taskd_cleanup (ourself)
         p = subprocess.Popen(['pgrep', '-f', '/paster taskd '],
-                stdout=subprocess.PIPE,
-                stderr=subprocess.PIPE)
+                             stdout=subprocess.PIPE,
+                             stderr=subprocess.PIPE)
         stdout, stderr = p.communicate()
         tasks = []
         if p.returncode == 0:
@@ -134,11 +142,12 @@ class TaskdCleanupCommand(base.Command):
         if not retry:
             os.kill(int(pid), signal.SIGUSR1)
         p = subprocess.Popen(['tail', '-n1', self.taskd_status_log],
-                stdout=subprocess.PIPE,
-                stderr=subprocess.PIPE)
+                             stdout=subprocess.PIPE,
+                             stderr=subprocess.PIPE)
         stdout, stderr = p.communicate()
         if p.returncode != 0:
-            base.log.error('Can\'t read taskd status log %s' % self.taskd_status_log)
+            base.log.error('Can\'t read taskd status log %s' %
+                           self.taskd_status_log)
             exit(1)
         return stdout
 
@@ -156,7 +165,8 @@ class TaskdCleanupCommand(base.Command):
         for i in range(self.options.num_retry):
             retry = False if i == 0 else True
             status = self._taskd_status(taskd_pid, retry)
-            line = 'taskd pid %s is currently handling task %s' % (taskd_pid, task)
+            line = 'taskd pid %s is currently handling task %s' % (
+                taskd_pid, task)
             if line in status:
                 return 'OK'
             base.log.info('retrying after one second')
@@ -168,7 +178,7 @@ class TaskdCleanupCommand(base.Command):
         # find all 'busy' tasks for this pid and mark them as 'error'
         tasks = list(self._busy_tasks(pid=pid))
         base.log.info('...taskd pid %s has assigned tasks: %s. '
-                'setting state to \'error\' for all of them' % (pid, tasks))
+                      'setting state to \'error\' for all of them' % (pid, tasks))
         for task in tasks:
             task.state = 'error'
             task.result = 'Taskd has stuck with this task'
@@ -178,7 +188,7 @@ class TaskdCleanupCommand(base.Command):
         complete_tasks = M.MonQTask.query.find({
             'state': 'complete',
             '_id': {'$in': [t._id for t in self.suspicious_tasks]}
-        });
+        })
         return [t._id for t in complete_tasks]
 
     def _check_suspicious_tasks(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/config/app_cfg.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/app_cfg.py b/Allura/allura/config/app_cfg.py
index 6f15406..6a60689 100644
--- a/Allura/allura/config/app_cfg.py
+++ b/Allura/allura/config/app_cfg.py
@@ -48,6 +48,7 @@ from allura.lib.package_path_loader import PackagePathLoader
 
 log = logging.getLogger(__name__)
 
+
 class ForgeConfig(AppConfig):
 
     def __init__(self, root_controller='root'):
@@ -86,7 +87,7 @@ class ForgeConfig(AppConfig):
                 bcc = FileSystemBytecodeCache()
         except:
             log.exception("Error encountered while setting up a" +
-                        " %s-backed bytecode cache for Jinja" % cache_type)
+                          " %s-backed bytecode cache for Jinja" % cache_type)
         return bcc
 
     def setup_jinja_renderer(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/config/environment.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/environment.py b/Allura/allura/config/environment.py
index 3db89d1..35676fd 100644
--- a/Allura/allura/config/environment.py
+++ b/Allura/allura/config/environment.py
@@ -27,6 +27,5 @@ from allura.config.app_cfg import base_config
 
 __all__ = ['load_environment']
 
-#Use base_config to setup the environment loader function
+# Use base_config to setup the environment loader function
 load_environment = base_config.make_load_environment()
-

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/config/middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/middleware.py b/Allura/allura/config/middleware.py
index fc02ffb..cface6d 100644
--- a/Allura/allura/config/middleware.py
+++ b/Allura/allura/config/middleware.py
@@ -59,6 +59,7 @@ def make_app(global_conf, full_stack=True, **app_conf):
     root = app_conf.get('override_root', 'root')
     return _make_core_app(root, global_conf, full_stack, **app_conf)
 
+
 def _make_core_app(root, global_conf, full_stack=True, **app_conf):
     """
     Set allura up with the settings found in the PasteDeploy configuration
@@ -124,7 +125,7 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
                                " the zarkov.host setting in your ini file."
 
     app = tg.TGApp()
-    if asbool(config.get('auth.method', 'local')=='sfx'):
+    if asbool(config.get('auth.method', 'local') == 'sfx'):
         import sfx.middleware
         d = h.config_with_prefix(config, 'auth.')
         d.update(h.config_with_prefix(config, 'sfx.'))
@@ -146,7 +147,7 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
     if (asbool(app_conf.get('auth.method', 'local') == 'sfx')
             and config.get('override_root') != 'task'):
         app = SSLMiddleware(app, app_conf.get('no_redirect.pattern'),
-                app_conf.get('force_ssl.pattern'))
+                            app_conf.get('force_ssl.pattern'))
     # Setup resource manager, widget context SOP
     app = ew.WidgetMiddleware(
         app,
@@ -166,21 +167,25 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
     # "task" wsgi would get a 2nd request to /error/document if we used this middleware
     if config.get('override_root') != 'task':
         # Converts exceptions to HTTP errors, shows traceback in debug mode
-        tg.error.footer_html = '<!-- %s %s -->'  # don't use TG footer with extra CSS & images that take time to load
-        app = tg.error.ErrorHandler(app, global_conf, **config['pylons.errorware'])
+        # don't use TG footer with extra CSS & images that take time to load
+        tg.error.footer_html = '<!-- %s %s -->'
+        app = tg.error.ErrorHandler(
+            app, global_conf, **config['pylons.errorware'])
 
         # Make sure that the wsgi.scheme is set appropriately when we
         # have the funky HTTP_X_SFINC_SSL  environ var
-        if asbool(app_conf.get('auth.method', 'local')=='sfx'):
+        if asbool(app_conf.get('auth.method', 'local') == 'sfx'):
             app = set_scheme_middleware(app)
-        
+
         # Redirect some status codes to /error/document
         if asbool(config['debug']):
             app = StatusCodeRedirect(app, base_config.handle_status_codes)
         else:
-            app = StatusCodeRedirect(app, base_config.handle_status_codes + [500])
+            app = StatusCodeRedirect(
+                app, base_config.handle_status_codes + [500])
     return app
 
+
 def set_scheme_middleware(app):
     def SchemeMiddleware(environ, start_response):
         if asbool(environ.get('HTTP_X_SFINC_SSL', 'false')):
@@ -188,17 +193,21 @@ def set_scheme_middleware(app):
         return app(environ, start_response)
     return SchemeMiddleware
 
+
 def allura_globals_middleware(app):
     def AlluraGlobalsMiddleware(environ, start_response):
         import allura.lib.security
         import allura.lib.app_globals
         registry = environ['paste.registry']
-        registry.register(allura.credentials, allura.lib.security.Credentials())
+        registry.register(allura.credentials,
+                          allura.lib.security.Credentials())
         return app(environ, start_response)
     return AlluraGlobalsMiddleware
 
+
 def get_tg_vars(context):
-    import pylons, tg
+    import pylons
+    import tg
     from allura.lib import helpers as h
     from urllib import quote, quote_plus
     context.setdefault('g', pylons.app_globals)
@@ -208,8 +217,8 @@ def get_tg_vars(context):
     context.setdefault('response', pylons.response)
     context.setdefault('url', pylons.url)
     context.setdefault('tg', dict(
-            config=tg.config,
-            flash_obj=tg.flash,
-            quote=quote,
-            quote_plus=quote_plus,
-            url=tg.url))
+        config=tg.config,
+        flash_obj=tg.flash,
+        quote=quote,
+        quote_plus=quote_plus,
+        url=tg.url))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/config/resources.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/resources.py b/Allura/allura/config/resources.py
index b289416..e8717fe 100644
--- a/Allura/allura/config/resources.py
+++ b/Allura/allura/config/resources.py
@@ -24,6 +24,7 @@ from allura.lib.helpers import iter_entry_points
 
 log = logging.getLogger(__name__)
 
+
 def register_ew_resources(manager):
     manager.register_directory(
         'js', pkg_resources.resource_filename('allura', 'lib/widgets/resources/js'))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/controllers/attachments.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/attachments.py b/Allura/allura/controllers/attachments.py
index 5b98881..fc0fbbc 100644
--- a/Allura/allura/controllers/attachments.py
+++ b/Allura/allura/controllers/attachments.py
@@ -24,6 +24,7 @@ from ming.utils import LazyProperty
 from allura.lib.security import require, has_access, require_access
 from .base import BaseController
 
+
 class AttachmentsController(BaseController):
     AttachmentControllerClass = None
 
@@ -35,11 +36,12 @@ class AttachmentsController(BaseController):
         if filename:
             if not args:
                 filename = request.path.rsplit('/', 1)[-1]
-            filename=unquote(filename)
+            filename = unquote(filename)
             return self.AttachmentControllerClass(filename, self.artifact), args
         else:
             raise exc.HTTPNotFound
 
+
 class AttachmentController(BaseController):
     AttachmentClass = None
     edit_perm = 'edit'
@@ -55,7 +57,8 @@ class AttachmentController(BaseController):
     def attachment(self):
         metadata = self.AttachmentClass.metadata_for(self.artifact)
         metadata['type'] = 'attachment'
-        attachment = self.AttachmentClass.query.get(filename=self.filename, **metadata)
+        attachment = self.AttachmentClass.query.get(
+            filename=self.filename, **metadata)
         if attachment is None:
             raise exc.HTTPNotFound
         return attachment
@@ -64,7 +67,8 @@ class AttachmentController(BaseController):
     def thumbnail(self):
         metadata = self.AttachmentClass.metadata_for(self.artifact)
         metadata['type'] = 'thumbnail'
-        attachment = self.AttachmentClass.query.get(filename=self.filename, **metadata)
+        attachment = self.AttachmentClass.query.get(
+            filename=self.filename, **metadata)
         if attachment is None:
             raise exc.HTTPNotFound
         return attachment
@@ -81,7 +85,7 @@ class AttachmentController(BaseController):
                 except exc.HTTPNotFound:
                     pass
             redirect(request.referer)
-        embed=False
+        embed = False
         if self.attachment.content_type and self.attachment.content_type.startswith('image/'):
             embed = True
         return self.attachment.serve(embed=embed)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index bb6e98f..587d151 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -15,7 +15,9 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
-import logging, string, os
+import logging
+import string
+import os
 from urllib import urlencode
 import datetime
 
@@ -48,7 +50,7 @@ from allura.controllers import BaseController
 
 log = logging.getLogger(__name__)
 
-OID_PROVIDERS=[
+OID_PROVIDERS = [
     ('OpenID', '${username}'),
     ('Yahoo!', 'http://yahoo.com'),
     ('Google', 'https://www.google.com/accounts/o8/id'),
@@ -60,16 +62,18 @@ OID_PROVIDERS=[
     ('Vidoop', 'http://${username}.myvidoop.com/'),
     ('Verisign', 'http://${username}.pip.verisignlabs.com/'),
     ('ClaimID', 'http://openid.claimid.com/${username}/'),
-    ('AOL', 'http://openid.aol.com/${username}/') ]
+    ('AOL', 'http://openid.aol.com/${username}/')]
+
 
 class F(object):
     login_form = LoginForm()
     recover_password_change_form = forms.PasswordChangeBase()
     forgotten_password_form = ForgottenPasswordForm()
-    subscription_form=SubscriptionForm()
+    subscription_form = SubscriptionForm()
     registration_form = forms.RegistrationForm(action='/auth/save_new')
     oauth_application_form = OAuthApplicationForm(action='register')
-    oauth_revocation_form = OAuthRevocationForm(action='/auth/preferences/revoke_oauth')
+    oauth_revocation_form = OAuthRevocationForm(
+        action='/auth/preferences/revoke_oauth')
     change_personal_data_form = forms.PersonalDataForm()
     add_socialnetwork_form = forms.AddSocialNetworkForm()
     remove_socialnetwork_form = forms.RemoveSocialNetworkForm()
@@ -84,6 +88,7 @@ class F(object):
     save_skill_form = forms.AddUserSkillForm()
     remove_skill_form = forms.RemoveSkillForm()
 
+
 class AuthController(BaseController):
 
     def __init__(self):
@@ -125,7 +130,8 @@ class AuthController(BaseController):
         else:
             oid_url = username
         return verify_oid(oid_url, failure_redirect='.',
-                          return_to='login_process_oid?%s' % urlencode(dict(return_to=return_to)),
+                          return_to='login_process_oid?%s' % urlencode(
+                              dict(return_to=return_to)),
                           title='OpenID Login',
                           prompt='Click below to continue')
 
@@ -160,11 +166,13 @@ class AuthController(BaseController):
         login_url = config.get('auth.login_url', '/auth/')
         if not hash:
             redirect(login_url)
-        user_record = M.User.query.find({'tool_data.AuthPasswordReset.hash': hash}).first()
+        user_record = M.User.query.find(
+            {'tool_data.AuthPasswordReset.hash': hash}).first()
         if not user_record:
             flash('Unable to process reset, please try again')
             redirect(login_url)
-        hash_expiry = user_record.get_tool_data('AuthPasswordReset', 'hash_expiry')
+        hash_expiry = user_record.get_tool_data(
+            'AuthPasswordReset', 'hash_expiry')
         if not hash_expiry or hash_expiry < datetime.datetime.utcnow():
             flash('Unable to process reset, please try again')
             redirect(login_url)
@@ -330,18 +338,19 @@ To reset your password on %s, please visit the following URL:
             return 'No project at %s' % repo_path
         if not rest:
             return '%s does not include a repo mount point' % repo_path
-        h.set_context(project.shortname, rest[0], neighborhood=project.neighborhood)
+        h.set_context(project.shortname,
+                      rest[0], neighborhood=project.neighborhood)
         if c.app is None or not getattr(c.app, 'repo'):
             return 'Cannot find repo at %s' % repo_path
         allura.tasks.repo_tasks.refresh.post()
         return '%r refresh queued.\n' % c.app.repo
 
-
     def _auth_repos(self, user):
         def _unix_group_name(neighborhood, shortname):
             'shameless copied from sfx_api.py'
-            path = neighborhood.url_prefix + shortname[len(neighborhood.shortname_prefix):]
-            parts = [ p for p in path.split('/') if p ]
+            path = neighborhood.url_prefix + \
+                shortname[len(neighborhood.shortname_prefix):]
+            parts = [p for p in path.split('/') if p]
             if len(parts) == 2 and parts[0] == 'p':
                 parts = parts[1:]
             return '.'.join(reversed(parts))
@@ -361,7 +370,6 @@ To reset your password on %s, please visit the following URL:
         repos.sort()
         return repos
 
-
     @expose('json:')
     def repo_permissions(self, repo_path=None, username=None, **kw):
         """Expects repo_path to be a filesystem path like
@@ -371,11 +379,12 @@ To reset your password on %s, please visit the following URL:
 
         Returns JSON describing this user's permissions on that repo.
         """
-        disallow = dict(allow_read=False, allow_write=False, allow_create=False)
+        disallow = dict(allow_read=False, allow_write=False,
+                        allow_create=False)
         # Find the user
         user = M.User.by_username(username)
         if not user:
-            response.status=404
+            response.status = 404
             return dict(disallow, error='unknown user')
         if not repo_path:
             return dict(allow_write=self._auth_repos(user))
@@ -387,7 +396,7 @@ To reset your password on %s, please visit the following URL:
             project, neighborhood = parts[0].split('.')
         else:
             project, neighborhood = parts[0], 'p'
-        parts = [ neighborhood, project ] + parts[1:]
+        parts = [neighborhood, project] + parts[1:]
         project_path = '/' + '/'.join(parts)
         project, rest = h.find_project(project_path)
         if project is None:
@@ -407,6 +416,7 @@ To reset your password on %s, please visit the following URL:
                     allow_write=has_access(c.app, 'write')(user=user),
                     allow_create=has_access(c.app, 'create')(user=user))
 
+
 class PreferencesController(BaseController):
 
     def _check_security(self):
@@ -419,9 +429,9 @@ class PreferencesController(BaseController):
         menu = provider.account_navigation()
         api_token = M.ApiToken.query.get(user_id=c.user._id)
         return dict(
-                menu=menu,
-                api_token=api_token,
-            )
+            menu=menu,
+            api_token=api_token,
+        )
 
     @h.vardec
     @expose()
@@ -436,14 +446,15 @@ class PreferencesController(BaseController):
                **kw):
         if config.get('auth.method', 'local') == 'local':
             if not preferences.get('display_name'):
-                flash("Display Name cannot be empty.",'error')
+                flash("Display Name cannot be empty.", 'error')
                 redirect('.')
             c.user.set_pref('display_name', preferences['display_name'])
             for i, (old_a, data) in enumerate(zip(c.user.email_addresses, addr or [])):
                 obj = c.user.address_object(old_a)
                 if data.get('delete') or not obj:
                     del c.user.email_addresses[i]
-                    if obj: obj.delete()
+                    if obj:
+                        obj.delete()
             c.user.set_pref('email_address', primary_addr)
             if new_addr.get('claim'):
                 if M.EmailAddress.query.get(_id=new_addr['addr'], confirmed=True):
@@ -451,14 +462,15 @@ class PreferencesController(BaseController):
                 else:
                     c.user.email_addresses.append(new_addr['addr'])
                     em = M.EmailAddress.upsert(new_addr['addr'])
-                    em.claimed_by_user_id=c.user._id
+                    em.claimed_by_user_id = c.user._id
                     em.send_verification_link()
             for i, (old_oid, data) in enumerate(zip(c.user.open_ids, oid or [])):
                 obj = c.user.openid_object(old_oid)
                 if data.get('delete') or not obj:
                     del c.user.open_ids[i]
-                    if obj: obj.delete()
-            for k,v in preferences.iteritems():
+                    if obj:
+                        obj.delete()
+            for k, v in preferences.iteritems():
                 if k == 'results_per_page':
                     v = int(v)
                 c.user.set_pref(k, v)
@@ -478,7 +490,8 @@ class PreferencesController(BaseController):
     @require_post()
     def del_api_token(self):
         tok = M.ApiToken.query.get(user_id=c.user._id)
-        if tok is None: return
+        if tok is None:
+            return
         tok.delete()
         redirect(request.referer)
 
@@ -513,6 +526,7 @@ class PreferencesController(BaseController):
         c.user.set_pref('disable_user_messages', not allow_user_messages)
         redirect(request.referer)
 
+
 class UserInfoController(BaseController):
 
     def __init__(self, *args, **kwargs):
@@ -537,13 +551,14 @@ class UserInfoController(BaseController):
         require_authenticated()
         c.user.set_pref('sex', kw['sex'])
         c.user.set_pref('birthdate', kw.get('birthdate'))
-        localization={'country':kw.get('country'), 'city':kw.get('city')}
+        localization = {'country': kw.get('country'), 'city': kw.get('city')}
         c.user.set_pref('localization', localization)
         c.user.set_pref('timezone', kw['timezone'])
 
         flash('Your personal data was successfully updated!')
         redirect('.')
 
+
 class UserSkillsController(BaseController):
 
     def __init__(self, category=None):
@@ -564,11 +579,13 @@ class UserSkillsController(BaseController):
         l = []
         parents = []
         if kw.get('selected_category') is not None:
-            selected_skill = M.TroveCategory.query.get(trove_cat_id=int(kw.get('selected_category')))
+            selected_skill = M.TroveCategory.query.get(
+                trove_cat_id=int(kw.get('selected_category')))
         elif self.category:
             selected_skill = self.category
         else:
-            l = M.TroveCategory.query.find(dict(trove_parent_id=0, show_as_skill=True)).all()
+            l = M.TroveCategory.query.find(
+                dict(trove_parent_id=0, show_as_skill=True)).all()
             selected_skill = None
         if selected_skill:
             l = [scat for scat in selected_skill.subcategories
@@ -580,10 +597,10 @@ class UserSkillsController(BaseController):
         provider = plugin.AuthenticationProvider.get(request)
         menu = provider.account_navigation()
         return dict(
-            skills_list = l,
-            selected_skill = selected_skill,
-            parents = parents,
-            menu = menu,
+            skills_list=l,
+            selected_skill=selected_skill,
+            parents=parents,
+            menu=menu,
             add_details_fields=(len(l) == 0))
 
     @expose()
@@ -618,6 +635,7 @@ class UserSkillsController(BaseController):
         flash('Your skills list was successfully updated!')
         redirect('.')
 
+
 class UserContactsController(BaseController):
 
     def _check_security(self):
@@ -693,6 +711,7 @@ class UserContactsController(BaseController):
         flash('Your personal contacts were successfully updated!')
         redirect('.')
 
+
 class UserAvailabilityController(BaseController):
 
     def _check_security(self):
@@ -741,6 +760,7 @@ class UserAvailabilityController(BaseController):
         flash('Your availability timeslots were successfully updated!')
         redirect('.')
 
+
 class SubscriptionsController(BaseController):
 
     def _check_security(self):
@@ -752,16 +772,17 @@ class SubscriptionsController(BaseController):
         c.form = F.subscription_form
         c.revoke_access = F.oauth_revocation_form
         subscriptions = []
-        mailboxes = M.Mailbox.query.find(dict(user_id=c.user._id, is_flash=False))
+        mailboxes = M.Mailbox.query.find(
+            dict(user_id=c.user._id, is_flash=False))
         mailboxes = list(mailboxes.ming_cursor)
         project_collection = M.Project.query.mapper.collection
         app_collection = M.AppConfig.query.mapper.collection
         projects = dict(
             (p._id, p) for p in project_collection.m.find(dict(
-                    _id={'$in': [mb.project_id for mb in mailboxes ]})))
+                _id={'$in': [mb.project_id for mb in mailboxes]})))
         app_index = dict(
             (ac._id, ac) for ac in app_collection.m.find(dict(
-                    _id={'$in': [mb.app_config_id for mb in mailboxes]})))
+                _id={'$in': [mb.app_config_id for mb in mailboxes]})))
 
         for mb in mailboxes:
             project = projects.get(mb.project_id, None)
@@ -772,15 +793,16 @@ class SubscriptionsController(BaseController):
             if app_config is None:
                 continue
             subscriptions.append(dict(
-                    subscription_id=mb._id,
-                    project_name=project.name,
-                    mount_point=app_config.options['mount_point'],
-                    artifact_title=dict(text=mb.artifact_title, href=mb.artifact_url),
-                    topic=mb.topic,
-                    type=mb.type,
-                    frequency=mb.frequency.unit,
-                    artifact=mb.artifact_index_id,
-                    subscribed=True))
+                subscription_id=mb._id,
+                project_name=project.name,
+                mount_point=app_config.options['mount_point'],
+                artifact_title=dict(
+                    text=mb.artifact_title, href=mb.artifact_url),
+                topic=mb.topic,
+                type=mb.type,
+                frequency=mb.frequency.unit,
+                artifact=mb.artifact_index_id,
+                subscribed=True))
 
         my_projects = dict((p._id, p) for p in c.user.my_projects())
         my_tools = app_collection.m.find(dict(
@@ -788,7 +810,7 @@ class SubscriptionsController(BaseController):
         for tool in my_tools:
             p_id = tool.project_id
             subscribed = M.Mailbox.subscribed(
-                    project_id=p_id, app_config_id=tool._id)
+                project_id=p_id, app_config_id=tool._id)
             if not subscribed:
                 subscriptions.append(dict(
                     tool_id=tool._id,
@@ -826,6 +848,7 @@ class SubscriptionsController(BaseController):
 
         redirect(request.referer)
 
+
 class OAuthController(BaseController):
 
     def _check_security(self):
@@ -839,16 +862,17 @@ class OAuthController(BaseController):
         access_tokens = M.OAuthAccessToken.for_user(c.user)
         provider = plugin.AuthenticationProvider.get(request)
         return dict(
-                menu=provider.account_navigation(),
-                consumer_tokens=consumer_tokens,
-                access_tokens=access_tokens,
-            )
+            menu=provider.account_navigation(),
+            consumer_tokens=consumer_tokens,
+            access_tokens=access_tokens,
+        )
 
     @expose()
     @require_post()
     @validate(F.oauth_application_form, error_handler=index)
     def register(self, application_name=None, application_description=None, **kw):
-        M.OAuthConsumerToken(name=application_name, description=application_description)
+        M.OAuthConsumerToken(name=application_name,
+                             description=application_description)
         flash('OAuth Application registered')
         redirect('.')
 
@@ -886,18 +910,18 @@ class OAuthController(BaseController):
             flash('Invalid app ID', 'error')
             redirect('.')
         request_token = M.OAuthRequestToken(
-                consumer_token_id=consumer_token._id,
-                user_id=c.user._id,
-                callback='manual',
-                validation_pin=h.nonce(20),
-                is_bearer=True,
-            )
+            consumer_token_id=consumer_token._id,
+            user_id=c.user._id,
+            callback='manual',
+            validation_pin=h.nonce(20),
+            is_bearer=True,
+        )
         access_token = M.OAuthAccessToken(
-                consumer_token_id=consumer_token._id,
-                request_token_id=c.user._id,
-                user_id=request_token.user_id,
-                is_bearer=True,
-            )
+            consumer_token_id=consumer_token._id,
+            request_token_id=c.user._id,
+            user_id=request_token.user_id,
+            is_bearer=True,
+        )
         redirect('.')
 
     @expose()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/controllers/base.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/base.py b/Allura/allura/controllers/base.py
index d599e21..215b19d 100644
--- a/Allura/allura/controllers/base.py
+++ b/Allura/allura/controllers/base.py
@@ -21,6 +21,7 @@ from tg.controllers.dispatcher import ObjectDispatcher
 
 
 class BaseController(object):
+
     @expose()
     def _lookup(self, name=None, *remainder):
         """Provide explicit default lookup to avoid dispatching backtracking
@@ -29,6 +30,7 @@ class BaseController(object):
 
 
 class DispatchIndex(object):
+
     """Rewrite default url dispatching for controller.
 
     Catch url that ends with `index.*` and pass it to the `_lookup()`

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/controllers/basetest_project_root.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/basetest_project_root.py b/Allura/allura/controllers/basetest_project_root.py
index ceb597b..91cf690 100644
--- a/Allura/allura/controllers/basetest_project_root.py
+++ b/Allura/allura/controllers/basetest_project_root.py
@@ -29,7 +29,7 @@ from webob import exc
 from tg import expose
 from tg.decorators import without_trailing_slash
 
-import  ming.orm.ormsession
+import ming.orm.ormsession
 
 import allura
 from allura.lib.base import WsgiDispatchController
@@ -49,7 +49,9 @@ __all__ = ['RootController']
 
 log = logging.getLogger(__name__)
 
+
 class BasetestProjectRootController(WsgiDispatchController, ProjectController):
+
     '''Root controller for testing -- it behaves just like a
     ProjectController for test/ except that all tools are mounted,
     on-demand, at the mount point that is the same as their entry point
@@ -84,14 +86,17 @@ class BasetestProjectRootController(WsgiDispatchController, ProjectController):
 
     def _setup_request(self):
         # This code fixes a race condition in our tests
-        c.project = M.Project.query.get(shortname='test', neighborhood_id=self.p_nbhd._id)
+        c.project = M.Project.query.get(
+            shortname='test', neighborhood_id=self.p_nbhd._id)
         c.memoize_cache = {}
         count = 20
         while c.project is None:
-            import sys, time
+            import sys
+            import time
             time.sleep(0.5)
             log.warning('Project "test" not found, retrying...')
-            c.project = M.Project.query.get(shortname='test', neighborhood_id=self.p_nbhd._id)
+            c.project = M.Project.query.get(
+                shortname='test', neighborhood_id=self.p_nbhd._id)
             count -= 1
             assert count > 0, 'Timeout waiting for test project to appear'
 
@@ -102,8 +107,9 @@ class BasetestProjectRootController(WsgiDispatchController, ProjectController):
     def _lookup(self, name, *remainder):
         if not h.re_project_name.match(name):
             raise exc.HTTPNotFound, name
-        subproject = M.Project.query.get(shortname=c.project.shortname + '/' + name,
-                                         neighborhood_id=self.p_nbhd._id)
+        subproject = M.Project.query.get(
+            shortname=c.project.shortname + '/' + name,
+            neighborhood_id=self.p_nbhd._id)
         if subproject:
             c.project = subproject
             c.app = None
@@ -123,7 +129,8 @@ class BasetestProjectRootController(WsgiDispatchController, ProjectController):
 
     def __call__(self, environ, start_response):
         c.app = None
-        c.project = M.Project.query.get(shortname='test', neighborhood_id=self.p_nbhd._id)
+        c.project = M.Project.query.get(
+            shortname='test', neighborhood_id=self.p_nbhd._id)
         auth = plugin.AuthenticationProvider.get(request)
         user = auth.by_username(environ.get('username', 'test-admin'))
         if not user:
@@ -132,6 +139,7 @@ class BasetestProjectRootController(WsgiDispatchController, ProjectController):
         c.user = auth.authenticate_request()
         return WsgiDispatchController.__call__(self, environ, start_response)
 
+
 class DispatchTest(object):
 
     @expose()
@@ -141,6 +149,7 @@ class DispatchTest(object):
         else:
             raise exc.HTTPNotFound()
 
+
 class NamedController(object):
 
     def __init__(self, name):
@@ -154,6 +163,7 @@ class NamedController(object):
     def _default(self, *args):
         return 'default(%s)(%r)' % (self.name, args)
 
+
 class SecurityTests(object):
 
     @expose()
@@ -163,16 +173,18 @@ class SecurityTests(object):
             c.user = M.User.anonymous()
         return SecurityTest(), args
 
+
 class SecurityTest(object):
 
     def __init__(self):
         from forgewiki import model as WM
         c.app = c.project.app_instance('wiki')
-        self.page = WM.Page.query.get(app_config_id=c.app.config._id, title='Home')
+        self.page = WM.Page.query.get(
+            app_config_id=c.app.config._id, title='Home')
 
     @expose()
     def forbidden(self):
-        require(lambda:False, 'Never allowed')
+        require(lambda: False, 'Never allowed')
         return ''
 
     @expose()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index b80b4e9..2eef299 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -42,16 +42,20 @@ from .feed import FeedArgs, FeedController
 
 log = logging.getLogger(__name__)
 
+
 class pass_validator(object):
+
     def validate(self, v, s):
         return v
-pass_validator=pass_validator()
+pass_validator = pass_validator()
+
 
 class ModelConfig(object):
-    Discussion=M.Discussion
-    Thread=M.Thread
-    Post=M.Post
-    Attachment=M.DiscussionAttachment
+    Discussion = M.Discussion
+    Thread = M.Thread
+    Post = M.Post
+    Attachment = M.DiscussionAttachment
+
 
 class WidgetConfig(object):
     # Forms
@@ -61,7 +65,7 @@ class WidgetConfig(object):
     moderate_post = DW.ModeratePost()
     flag_post = DW.FlagPost()
     post_filter = DW.PostFilter()
-    moderate_posts=DW.ModeratePosts()
+    moderate_posts = DW.ModeratePosts()
     # Other widgets
     discussion = DW.Discussion()
     thread = DW.Thread()
@@ -70,9 +74,11 @@ class WidgetConfig(object):
     discussion_header = DW.DiscussionHeader()
 
 # Controllers
+
+
 class DiscussionController(BaseController, FeedController):
-    M=ModelConfig
-    W=WidgetConfig
+    M = ModelConfig
+    W = WidgetConfig
 
     def __init__(self):
         if not hasattr(self, 'ThreadController'):
@@ -115,7 +121,8 @@ class DiscussionController(BaseController, FeedController):
 
         """
         return FeedArgs(
-            dict(ref_id={'$in': [t.index_id() for t in self.discussion.threads]}),
+            dict(ref_id={'$in': [t.index_id()
+                 for t in self.discussion.threads]}),
             'Recent posts to %s' % self.discussion.name,
             self.discussion.url())
 
@@ -124,16 +131,20 @@ class AppDiscussionController(DiscussionController):
 
     @LazyProperty
     def discussion(self):
-        return self.M.Discussion.query.get(shortname=c.app.config.options.mount_point,
-                                           app_config_id=c.app.config._id)
+        return self.M.Discussion.query.get(
+            shortname=c.app.config.options.mount_point,
+            app_config_id=c.app.config._id)
+
 
 class ThreadsController(BaseController):
-    __metaclass__=h.ProxiedAttrMeta
-    M=h.attrproxy('_discussion_controller', 'M')
-    W=h.attrproxy('_discussion_controller', 'W')
-    ThreadController=h.attrproxy('_discussion_controller', 'ThreadController')
-    PostController=h.attrproxy('_discussion_controller', 'PostController')
-    AttachmentController=h.attrproxy('_discussion_controller', 'AttachmentController')
+    __metaclass__ = h.ProxiedAttrMeta
+    M = h.attrproxy('_discussion_controller', 'M')
+    W = h.attrproxy('_discussion_controller', 'W')
+    ThreadController = h.attrproxy(
+        '_discussion_controller', 'ThreadController')
+    PostController = h.attrproxy('_discussion_controller', 'PostController')
+    AttachmentController = h.attrproxy(
+        '_discussion_controller', 'AttachmentController')
 
     def __init__(self, discussion_controller):
         self._discussion_controller = discussion_controller
@@ -141,18 +152,21 @@ class ThreadsController(BaseController):
     @expose()
     def _lookup(self, id=None, *remainder):
         if id:
-            id=unquote(id)
+            id = unquote(id)
             return self.ThreadController(self._discussion_controller, id), remainder
         else:
             raise exc.HTTPNotFound()
 
+
 class ThreadController(BaseController, FeedController):
-    __metaclass__=h.ProxiedAttrMeta
-    M=h.attrproxy('_discussion_controller', 'M')
-    W=h.attrproxy('_discussion_controller', 'W')
-    ThreadController=h.attrproxy('_discussion_controller', 'ThreadController')
-    PostController=h.attrproxy('_discussion_controller', 'PostController')
-    AttachmentController=h.attrproxy('_discussion_controller', 'AttachmentController')
+    __metaclass__ = h.ProxiedAttrMeta
+    M = h.attrproxy('_discussion_controller', 'M')
+    W = h.attrproxy('_discussion_controller', 'W')
+    ThreadController = h.attrproxy(
+        '_discussion_controller', 'ThreadController')
+    PostController = h.attrproxy('_discussion_controller', 'PostController')
+    AttachmentController = h.attrproxy(
+        '_discussion_controller', 'AttachmentController')
 
     def _check_security(self):
         require_access(self.thread, 'read')
@@ -168,7 +182,7 @@ class ThreadController(BaseController, FeedController):
 
     @expose()
     def _lookup(self, id, *remainder):
-        id=unquote(id)
+        id = unquote(id)
         return self.PostController(self._discussion_controller, self.thread, id), remainder
 
     @expose('jinja:allura:templates/discussion/thread.html')
@@ -177,7 +191,8 @@ class ThreadController(BaseController, FeedController):
         c.thread_header = self.W.thread_header
         limit, page, start = g.handle_paging(limit, page)
         self.thread.num_views += 1
-        M.session.artifact_orm_session._get().skip_mod_date = True # the update to num_views shouldn't affect it
+        # the update to num_views shouldn't affect it
+        M.session.artifact_orm_session._get().skip_mod_date = True
         count = self.thread.query_posts(page=page, limit=int(limit)).count()
         return dict(discussion=self.thread.discussion,
                     thread=self.thread,
@@ -200,7 +215,8 @@ class ThreadController(BaseController, FeedController):
             require_access(self.thread.ref.artifact, 'post')
         kw = self.W.edit_post.to_python(kw, None)
         if not kw['text']:
-            flash('Your post was not saved. You must provide content.', 'error')
+            flash('Your post was not saved. You must provide content.',
+                  'error')
             redirect(request.referer)
 
         file_info = kw.get('file_info', None)
@@ -241,12 +257,14 @@ class ThreadController(BaseController, FeedController):
 
 
 class PostController(BaseController):
-    __metaclass__=h.ProxiedAttrMeta
-    M=h.attrproxy('_discussion_controller', 'M')
-    W=h.attrproxy('_discussion_controller', 'W')
-    ThreadController=h.attrproxy('_discussion_controller', 'ThreadController')
-    PostController=h.attrproxy('_discussion_controller', 'PostController')
-    AttachmentController=h.attrproxy('_discussion_controller', 'AttachmentController')
+    __metaclass__ = h.ProxiedAttrMeta
+    M = h.attrproxy('_discussion_controller', 'M')
+    W = h.attrproxy('_discussion_controller', 'W')
+    ThreadController = h.attrproxy(
+        '_discussion_controller', 'ThreadController')
+    PostController = h.attrproxy('_discussion_controller', 'PostController')
+    AttachmentController = h.attrproxy(
+        '_discussion_controller', 'AttachmentController')
 
     def _check_security(self):
         require_access(self.post, 'read')
@@ -259,7 +277,8 @@ class PostController(BaseController):
 
     @LazyProperty
     def post(self):
-        post = self.M.Post.query.get(slug=self._post_slug, thread_id=self.thread._id)
+        post = self.M.Post.query.get(
+            slug=self._post_slug, thread_id=self.thread._id)
         if post:
             return post
         post = self.M.Post.query.get(slug=self._post_slug)
@@ -279,7 +298,7 @@ class PostController(BaseController):
             post_fields = self.W.edit_post.to_python(kw, None)
             file_info = post_fields.pop('file_info', None)
             self.post.add_multiple_attachments(file_info)
-            for k,v in post_fields.iteritems():
+            for k, v in post_fields.iteritems():
                 try:
                     setattr(self.post, k, v)
                 except AttributeError:
@@ -289,14 +308,16 @@ class PostController(BaseController):
             self.post.last_edit_by_id = c.user._id
             self.post.commit()
             g.director.create_activity(c.user, 'modified', self.post,
-                    target=self.post.thread.artifact or self.post.thread,
-                    related_nodes=[self.post.app_config.project])
+                                       target=self.post.thread.artifact or self.post.thread,
+                                       related_nodes=[self.post.app_config.project])
             redirect(request.referer)
-        elif request.method=='GET':
+        elif request.method == 'GET':
             if version is not None:
                 HC = self.post.__mongometa__.history_class
-                ss = HC.query.find({'artifact_id':self.post._id, 'version':int(version)}).first()
-                if not ss: raise exc.HTTPNotFound
+                ss = HC.query.find(
+                    {'artifact_id': self.post._id, 'version': int(version)}).first()
+                if not ss:
+                    raise exc.HTTPNotFound
                 post = Object(
                     ss.data,
                     acl=self.post.acl,
@@ -307,9 +328,9 @@ class PostController(BaseController):
                     attachments=self.post.attachments,
                     related_artifacts=self.post.related_artifacts,
                     parent_security_context=lambda: None,
-                    )
+                )
             else:
-                post=self.post
+                post = self.post
             return dict(discussion=self.post.discussion,
                         post=post)
 
@@ -341,9 +362,10 @@ class PostController(BaseController):
             self.post.spam()
         elif kw.pop('approve', None):
             self.post.status = 'ok'
-            g.spam_checker.submit_ham(self.post.text, artifact=self.post, user=c.user)
+            g.spam_checker.submit_ham(
+                self.post.text, artifact=self.post, user=c.user)
         self.thread.update_stats()
-        return dict(result ='success')
+        return dict(result='success')
 
     @h.vardec
     @expose()
@@ -366,26 +388,31 @@ class PostController(BaseController):
 
     @expose()
     def _lookup(self, id, *remainder):
-        id=unquote(id)
+        id = unquote(id)
         return self.PostController(
             self._discussion_controller,
             self.thread, self._post_slug + '/' + id), remainder
 
+
 class DiscussionAttachmentController(AttachmentController):
-    AttachmentClass=M.DiscussionAttachment
-    edit_perm='moderate'
+    AttachmentClass = M.DiscussionAttachment
+    edit_perm = 'moderate'
+
 
 class DiscussionAttachmentsController(AttachmentsController):
-    AttachmentControllerClass=DiscussionAttachmentController
+    AttachmentControllerClass = DiscussionAttachmentController
+
 
 class ModerationController(BaseController):
-    __metaclass__=h.ProxiedAttrMeta
+    __metaclass__ = h.ProxiedAttrMeta
     PostModel = M.Post
-    M=h.attrproxy('_discussion_controller', 'M')
-    W=h.attrproxy('_discussion_controller', 'W')
-    ThreadController=h.attrproxy('_discussion_controller', 'ThreadController')
-    PostController=h.attrproxy('_discussion_controller', 'PostController')
-    AttachmentController=h.attrproxy('_discussion_controller', 'AttachmentController')
+    M = h.attrproxy('_discussion_controller', 'M')
+    W = h.attrproxy('_discussion_controller', 'W')
+    ThreadController = h.attrproxy(
+        '_discussion_controller', 'ThreadController')
+    PostController = h.attrproxy('_discussion_controller', 'PostController')
+    AttachmentController = h.attrproxy(
+        '_discussion_controller', 'AttachmentController')
 
     def _check_security(self):
         require_access(self.discussion, 'moderate')
@@ -413,7 +440,7 @@ class ModerationController(BaseController):
         if status != '-':
             query['status'] = status
         if flag:
-            query['flags'] = {'$gte': int(flag) }
+            query['flags'] = {'$gte': int(flag)}
         q = self.PostModel.query.find(query)
         count = q.count()
         if not page:
@@ -437,7 +464,9 @@ class ModerationController(BaseController):
             if 'checked' in p:
                 posted = self.PostModel.query.get(
                     _id=p['_id'],
-                    discussion_id=self.discussion._id,  # make sure nobody hacks the HTML form to moderate other posts
+                    # make sure nobody hacks the HTML form to moderate other
+                    # posts
+                    discussion_id=self.discussion._id,
                 )
                 if posted:
                     if delete:
@@ -450,13 +479,15 @@ class ModerationController(BaseController):
                         posted.spam()
                     elif approve and posted.status != 'ok':
                         posted.status = 'ok'
-                        g.spam_checker.submit_ham(posted.text, artifact=posted, user=c.user)
+                        g.spam_checker.submit_ham(
+                            posted.text, artifact=posted, user=c.user)
                         posted.thread.last_post_date = max(
                             posted.thread.last_post_date,
                             posted.mod_date)
                         posted.thread.num_replies += 1
         redirect(request.referer)
 
+
 class PostRestController(PostController):
 
     @expose('json:')
@@ -474,6 +505,7 @@ class PostRestController(PostController):
         self.thread.num_replies += 1
         redirect(post.slug.split('/')[-1] + '/')
 
+
 class ThreadRestController(ThreadController):
 
     @expose('json:')
@@ -490,6 +522,7 @@ class ThreadRestController(ThreadController):
         p = self.thread.add_post(**kw)
         redirect(p.slug + '/')
 
+
 class AppDiscussionRestController(AppDiscussionController):
     ThreadController = ThreadRestController
     PostController = PostRestController

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/controllers/feed.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/feed.py b/Allura/allura/controllers/feed.py
index f6e1420..7aaa789 100644
--- a/Allura/allura/controllers/feed.py
+++ b/Allura/allura/controllers/feed.py
@@ -26,12 +26,14 @@ from allura.lib import helpers as h
 
 
 class FeedArgs(object):
+
     """A facade for the arguments required by
     :meth:`allura.model.artifact.Feed.feed`.
 
     Used by :meth:`FeedController.feed` to create a real feed.
 
     """
+
     def __init__(self, query, title, url, description=None):
         self.query = query
         self.title = title
@@ -40,6 +42,7 @@ class FeedArgs(object):
 
 
 class FeedController(object):
+
     """Mixin class which adds RSS and Atom feed endpoints to an existing
     controller.
 
@@ -70,10 +73,10 @@ class FeedController(object):
     @without_trailing_slash
     @expose()
     @validate(dict(
-            since=h.DateTimeConverter(if_empty=None, if_invalid=None),
-            until=h.DateTimeConverter(if_empty=None, if_invalid=None),
-            page=V.Int(if_empty=None, if_invalid=None),
-            limit=V.Int(if_empty=None, if_invalid=None)))
+        since=h.DateTimeConverter(if_empty=None, if_invalid=None),
+        until=h.DateTimeConverter(if_empty=None, if_invalid=None),
+        page=V.Int(if_empty=None, if_invalid=None),
+        limit=V.Int(if_empty=None, if_invalid=None)))
     def feed(self, since=None, until=None, page=None, limit=None, **kw):
         """Return a utf8-encoded XML feed (RSS or Atom) to the browser.
         """