Commit 606b2530 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

snf-django: PEP8 fixes

parent 2c055047
......@@ -138,7 +138,8 @@ def api_method(http_method=None, token_required=True, user_required=True,
return decorator
def get_serialization(request, format_allowed=True, default_serialization="json"):
def get_serialization(request, format_allowed=True,
default_serialization="json"):
"""Return the serialization format requested.
Valid formats are 'json' and 'xml' and 'text'
......@@ -191,7 +192,8 @@ def update_response_headers(request, response):
if not response.has_header("Content-Length"):
# compatibility code for django 1.4
_is_string = getattr(response, '_is_string', None)
_base_content_is_iter = getattr(response, '_base_content_is_iter', None)
_base_content_is_iter = getattr(response, '_base_content_is_iter',
None)
if (_is_string is not None and _is_string) or\
(_base_content_is_iter is not None and
not _base_content_is_iter):
......
......@@ -43,4 +43,4 @@ def fix_header(k, v):
def forward_header(k):
return k.upper() not in ['HOST', 'CONTENT_LENGTH', 'CONTENT_TYPE'] and \
not is_hop_by_hop(k) and not '.' in k
not is_hop_by_hop(k) and not '.' in k
......@@ -32,6 +32,7 @@ from django.db.models import Manager
from django.db.models.query import QuerySet, EmptyQuerySet
from django.db.models.sql.datastructures import EmptyResultSet
class ForUpdateManager(Manager):
""" Model manager implementing SELECT .. FOR UPDATE statement
......@@ -60,9 +61,9 @@ class ForUpdateManager(Manager):
return query[0]
if not num:
raise self.model.DoesNotExist(
"%s matching query does not exist. "
"Lookup parameters were %s" %
(self.model._meta.object_name, kwargs))
"%s matching query does not exist. "
"Lookup parameters were %s" %
(self.model._meta.object_name, kwargs))
raise self.model.MultipleObjectsReturned(
"get() returned more than one %s -- it returned %s! "
"Lookup parameters were %s" %
......
......@@ -171,7 +171,7 @@ def pprint_table(out, table, headers=None, output_format='pretty',
out.write(title.center(t_length) + "\n")
if headers:
# pretty print the headers
line = sep.join(uenc(v.rjust(w))\
line = sep.join(uenc(v.rjust(w))
for v, w in zip(headers, widths))
out.write(line + "\n")
out.write("-" * t_length + "\n")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment