Commits

Anonymous committed e67c318

Tidied with flake8

Comments (0)

Files changed (5)

gnocchi/cms/management/commands/dump_templates.py

 from gnocchi.cms.models import Template
 import os
 
+
 class Command(BaseCommand):
     help = 'Dump DB-stored templates to files'
     option_list = BaseCommand.option_list + (
-        make_option('--path', dest='path', metavar='PATH',
-            help='Path to save templates into', default='templates'
+        make_option(
+            '--path',
+            dest='path',
+            metavar='PATH',
+            default='templates',
+            help='Path to save templates into',
         ),
     )
 

gnocchi/cms/management/commands/load_templates.py

 from gnocchi.cms.models import Template
 import os
 
+
 class Command(BaseCommand):
     help = 'Load templates into DB'
     option_list = BaseCommand.option_list + (
-        make_option('--path', dest='path', metavar='PATH',
-            help='Path to load templates from', default='templates'
+        make_option(
+            '--path',
+            dest='path',
+            metavar='PATH',
+            default='templates',
+            help='Path to load templates from',
         ),
-        make_option('-o', '--overwrite', dest='overwrite', action='store_true',
-            default = False, help='Overwrite existing templates',
+        make_option(
+            '-o',
+            '--overwrite',
+            dest='overwrite',
+            action='store_true',
+            default=False,
+            help='Overwrite existing templates',
         )
     )
 

gnocchi/cms/middleware.py

 
 from django.contrib.sites.models import Site
 
+
 class SiteMiddleware(object):
     ''' Middleware to add the current Site to the request'''
     def process_request(self, request):
 from gnocchi.cms import settings
 import re
 
+
 class SmartSiteMiddleware(object):
     '''Load a site matching the requested site, or the default if none match'''
     def process_request(self, request):

gnocchi/cms/templatetags/cms.py

 
 register = template.Library()
 
+
 @register.filter
 @stringfilter
 def split(value, arg='\n'):
     return value.split(arg)
 
+
 class GetPage(template.Node):
     def __init__(self, varname, args):
         self.varname = varname
         context[varname] = page
         return ''
 
+
 @register.tag
 def get_page(parser, token):
     args, kwargs, as_name = parse_args(parser, token, 'page')
     # if args: fail
     return GetPage(as_name, kwargs)
 
+
 @register.tag(name='template')
 def do_template(parser, token):
     nodes = parser.parse(('endtemplate',))
     parser.delete_first_token()
     return TemplateTagNode(nodes)
 
+
 class TemplateTagNode(template.Node):
     def __init__(self, nodes):
         self.children = nodes
     def render(self, context):
         tmpl = template.Template(self.children.render(context))
         return tmpl.render(context)
-

gnocchi/cms/templatetags/markup.py

 
 register = template.Library()
 
+
 @register.filter(is_safe=True)
 def textile(value):
     try:
     else:
         return mark_safe(force_text(textile.textile(force_bytes(value), encoding='utf-8', output='utf-8')))
 
+
 @register.filter(is_safe=True)
 def markdown(value, arg=''):
     """
                 return mark_safe(markdown.markdown(
                     force_text(value), extensions, safe_mode=False))
 
+
 @register.filter(is_safe=True)
 def restructuredtext(value):
     import warnings