flake8 cleanups, ununsed imports and variables cleanup, changed register_diagnostics to use reverse_lazy instead of reverse

This commit is contained in:
Roberto Rosario
2011-05-06 10:39:54 -04:00
parent c40b3eec66
commit 07e9b12e78
14 changed files with 33 additions and 40 deletions
@@ -19,11 +19,11 @@ class RenderSubtemplateNode(Node):
new_context = Context(context)
new_context.update(Context(template_context, autoescape=context.autoescape))
csrf_token = context.get('csrf_token', None)
if csrf_token is not None:
new_context['csrf_token'] = csrf_token
context[self.var_name] = get_template(template_name).render(new_context)
return ''
@@ -40,12 +40,12 @@ def render_subtemplate(parser, token):
if not m:
raise TemplateSyntaxError('%r tag had invalid arguments' % tag_name)
template_name, template_context, var_name = m.groups()
if (template_name[0] == template_name[-1] and template_name[0] in ('"', "'")):
raise TemplateSyntaxError('%r tag\'s template name argument should not be in quotes' % tag_name)
if (template_context[0] == template_context[-1] and template_context[0] in ('"', "'")):
raise TemplateSyntaxError('%r tag\'s template context argument should not be in quotes' % tag_name)
return RenderSubtemplateNode(template_name, template_context, var_name)
#format_string[1:-1]
+5 -5
View File
@@ -94,7 +94,7 @@ def pretty_size(size, suffixes=None):
def pretty_size_10(size):
return pretty_size(
size,
size,
suffixes=[
(u'B', 1000L), (u'K', 1000000L), (u'M', 1000000000L),
(u'G', 1000000000000L), (u'T', 1000000000000000L)
@@ -302,12 +302,12 @@ def return_type(value):
return ','.join(list(value))
else:
return value
# http://stackoverflow.com/questions/4248399/page-range-for-printing-algorithm
def parse_range(astr):
result=set()
result = set()
for part in astr.split(u','):
x=part.split(u'-')
result.update(range(int(x[0]),int(x[-1])+1))
x = part.split(u'-')
result.update(range(int(x[0]), int(x[-1]) + 1))
return sorted(result)