changeset 391:2156d47b577f

code: More PEP8 and other cosmetic fixes.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 14 Oct 2015 20:55:58 -0700
parents 5855c42752be
children e551a6918907
files wikked/commands/web.py wikked/scm/git.py
diffstat 2 files changed, 24 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/wikked/commands/web.py	Wed Oct 14 20:50:42 2015 -0700
+++ b/wikked/commands/web.py	Wed Oct 14 20:55:58 2015 -0700
@@ -20,32 +20,39 @@
         self.description = ("Runs the wiki in a local web server.")
 
     def setupParser(self, parser):
-        parser.add_argument('--host',
+        parser.add_argument(
+                '--host',
                 help="The host to use",
                 default='127.0.0.1')
-        parser.add_argument('--port',
+        parser.add_argument(
+                '--port',
                 help="The port to use",
                 default=5000)
-        parser.add_argument('--usetasks',
+        parser.add_argument(
+                '--usetasks',
                 help="Use background tasks for updating the wiki after a "
                      "page has been edited. You will have to run "
                      "`wk runtasks` at the same time as `wk runserver`.",
                 action='store_true')
-        parser.add_argument('-d', '--dev',
+        parser.add_argument(
+                '-d', '--dev',
                 help="Use development mode. "
                      "This makes Wikked use development assets (separate and "
                      "uncompressed scripts and stylesheets), along with using "
                      "code reloading and debugging.",
                 action='store_true')
-        parser.add_argument('--no-update',
+        parser.add_argument(
+                '--no-update',
                 help="Don't auto-update the wiki if a page file has been "
                      "touched (which means you can refresh a locally modified "
                      "page with F5)",
                 action='store_true')
-        parser.add_argument('--no-startup-update',
+        parser.add_argument(
+                '--no-startup-update',
                 help="Don't update the wiki before starting the server.",
                 action='store_true')
-        parser.add_argument('-c', '--config',
+        parser.add_argument(
+                '-c', '--config',
                 help="Pass some configuration value to the Flask application. "
                      "This must be of the form: name=value",
                 nargs="*")
@@ -107,7 +114,8 @@
     def __init__(self):
         super(RunTasksCommand, self).__init__()
         self.name = 'runtasks'
-        self.description = "Runs the tasks to update the wiki in the background."
+        self.description = ("Runs the tasks to update the wiki in the "
+                            "background.")
 
     def setupParser(self, parser):
         pass
@@ -117,13 +125,14 @@
         # stuff as what the Flask app got.
         from wikked.tasks import celery_app
 
-        celery_app.conf.update(BROKER_URL='sqla+sqlite:///%(root)s/.wiki/broker.db')
+        celery_app.conf.update(
+                BROKER_URL='sqla+sqlite:///%(root)s/.wiki/broker.db')
         config_path = os.path.join(ctx.params.root, '.wiki', 'app.cfg')
         if os.path.isfile(config_path):
             obj = self._loadConfig(config_path)
             celery_app.conf.update(obj.__dict__)
         celery_app.conf.BROKER_URL = celery_app.conf.BROKER_URL % (
-                { 'root': ctx.params.root })
+                {'root': ctx.params.root})
 
         os.chdir(os.path.join(os.path.dirname(__file__), '..', '..'))
         argv = ['celery', 'worker', '-A', 'wikked.tasks']
@@ -138,6 +147,8 @@
             with open(path) as config_file:
                 exec(compile(config_file.read(), path, 'exec'), d.__dict__)
         except IOError as e:
-            e.strerror = 'Unable to load Flask/Celery configuration file (%s)' % e.strerror
+            e.strerror = (
+                    'Unable to load Flask/Celery configuration file (%s)' %
+                    e.strerror)
             raise
         return d
--- a/wikked/scm/git.py	Wed Oct 14 20:50:42 2015 -0700
+++ b/wikked/scm/git.py	Wed Oct 14 20:55:58 2015 -0700
@@ -56,7 +56,8 @@
 class GitLibSourceControl(GitBaseSourceControl):
     def __init__(self, root):
         if not SUPPORTS_GIT:
-            raise Exception("Can't support Git because pygit2 is not available.")
+            raise Exception(
+                    "Can't support Git because pygit2 is not available.")
         GitBaseSourceControl.__init__(self, root)
 
     def initRepo(self, wiki):