PEP8 cleanups, style cleanups, unused imports
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
@@ -18,7 +18,7 @@ from django.contrib.auth.models import User
|
||||
|
||||
|
||||
def urlquote(link=None, get=None):
|
||||
u'''
|
||||
u"""
|
||||
This method does both: urlquote() and urlencode()
|
||||
|
||||
urlqoute(): Quote special characters in 'link'
|
||||
@@ -33,7 +33,7 @@ def urlquote(link=None, get=None):
|
||||
urlquote('/mypath/', {'key': 'value'}) --> '/mypath/?key=value'
|
||||
urlquote('/mypath/', {'key': ['value1', 'value2']}) --> '/mypath/?key=value1&key=value2'
|
||||
urlquote({'key': ['value1', 'value2']}) --> 'key=value1&key=value2'
|
||||
'''
|
||||
"""
|
||||
if get is None:
|
||||
get = []
|
||||
|
||||
@@ -112,9 +112,9 @@ def pretty_size_10(size):
|
||||
# http://www.johncardinal.com/tmgutil/capitalizenames.htm
|
||||
|
||||
def proper_name(name):
|
||||
'''
|
||||
"""
|
||||
Does the work of capitalizing a name (can be a full name).
|
||||
'''
|
||||
"""
|
||||
mc = re.compile(r'^Mc(\w)(?=\w)', re.I)
|
||||
mac = re.compile(r'^Mac(\w)(?=\w)', re.I)
|
||||
suffixes = [
|
||||
@@ -330,7 +330,7 @@ def generate_choices_w_labels(choices, display_object_type=True):
|
||||
return sorted(results, key=lambda x: x[1])
|
||||
|
||||
|
||||
def get_object_name(obj, display_object_type=True):
|
||||
def get_object_name(obj, display_object_type=True):
|
||||
ct_label = ContentType.objects.get_for_model(obj).name
|
||||
if isinstance(obj, User):
|
||||
label = obj.get_full_name() if obj.get_full_name() else obj
|
||||
@@ -342,7 +342,7 @@ def get_object_name(obj, display_object_type=True):
|
||||
verbose_name = unicode(obj._meta.verbose_name)
|
||||
except AttributeError:
|
||||
verbose_name = ct_label
|
||||
|
||||
|
||||
return u'%s: %s' % (verbose_name, label)
|
||||
else:
|
||||
return u'%s' % (label)
|
||||
|
||||
Reference in New Issue
Block a user