PEP8 cleanups

This commit is contained in:
Roberto Rosario
2015-06-14 03:52:18 -04:00
parent 37b4f42afe
commit d8322031c5
9 changed files with 7 additions and 36 deletions

View File

@@ -23,7 +23,7 @@ from .links import (
from .menus import ( from .menus import (
menu_facet, menu_main, menu_secondary, menu_setup, menu_tools menu_facet, menu_main, menu_secondary, menu_setup, menu_tools
) )
from .models import AnonymousUserSingleton, UserLocaleProfile from .models import AnonymousUserSingleton
from .settings import TEMPORARY_DIRECTORY from .settings import TEMPORARY_DIRECTORY
from .utils import validate_path from .utils import validate_path

View File

@@ -83,4 +83,3 @@ class MissingItem(object):
self.description = description self.description = description
self.view = view self.view = view
self.__class__._registry.append(self) self.__class__._registry.append(self)

View File

@@ -5,7 +5,6 @@ import os
from django import forms from django import forms
from django.conf import settings from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models from django.db import models
from django.utils.html import escape from django.utils.html import escape
@@ -13,7 +12,7 @@ from django.utils.translation import ugettext_lazy as _
from .models import UserLocaleProfile from .models import UserLocaleProfile
from .utils import return_attrib from .utils import return_attrib
from .widgets import DetailSelectMultiple, EmailInput, PlainWidget from .widgets import DetailSelectMultiple, PlainWidget
class DetailForm(forms.ModelForm): class DetailForm(forms.ModelForm):

View File

@@ -2,9 +2,7 @@ from __future__ import unicode_literals
from django.conf import settings from django.conf import settings
from .models import ( from .models import UserLocaleProfile
AnonymousUserSingleton, UserLocaleProfile
)
def user_locale_profile_session_config(sender, request, user, **kwargs): def user_locale_profile_session_config(sender, request, user, **kwargs):

View File

@@ -14,4 +14,3 @@ def project_name():
@register.simple_tag @register.simple_tag
def project_version(): def project_version():
return mayan.__version__ return mayan.__version__

View File

@@ -16,4 +16,3 @@ def render_subtemplate(context, template_name, template_context):
new_context = Context(context) new_context = Context(context)
new_context.update(Context(template_context)) new_context.update(Context(template_context))
return get_template(template_name).render(new_context) return get_template(template_name).render(new_context)

View File

@@ -11,8 +11,6 @@ from django.contrib.contenttypes.models import ContentType
from django.utils.datastructures import MultiValueDict from django.utils.datastructures import MultiValueDict
from django.utils.http import urlquote as django_urlquote from django.utils.http import urlquote as django_urlquote
from django.utils.http import urlencode as django_urlencode from django.utils.http import urlencode as django_urlencode
from django.utils.importlib import import_module
from django.utils.translation import ugettext_lazy as _
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -87,7 +85,6 @@ def get_descriptor(file_input, read=True):
def get_object_name(obj): def get_object_name(obj):
ct_label = ContentType.objects.get_for_model(obj).name
if isinstance(obj, User): if isinstance(obj, User):
label = obj.get_full_name() if obj.get_full_name() else obj label = obj.get_full_name() if obj.get_full_name() else obj
else: else:

View File

@@ -5,12 +5,11 @@ from json import dumps, loads
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.auth.views import login, password_change
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect from django.http import Http404, HttpResponseRedirect
from django.shortcuts import redirect, render_to_response from django.shortcuts import render_to_response
from django.template import RequestContext from django.template import RequestContext
from django.utils.http import urlencode from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
@@ -20,7 +19,6 @@ from django.views.generic.edit import CreateView, DeleteView, UpdateView
from django.views.generic.list import ListView from django.views.generic.list import ListView
from dynamic_search.classes import SearchModel from dynamic_search.classes import SearchModel
from permissions.models import Permission
from .api import tools from .api import tools
from .classes import MissingItem from .classes import MissingItem
@@ -33,7 +31,6 @@ from .mixins import (
ExtraContextMixin, ObjectListPermissionFilterMixin, ExtraContextMixin, ObjectListPermissionFilterMixin,
ObjectPermissionCheckMixin, RedirectionMixin, ViewPermissionCheckMixin ObjectPermissionCheckMixin, RedirectionMixin, ViewPermissionCheckMixin
) )
from .utils import return_attrib
class AssignRemoveView(TemplateView): class AssignRemoveView(TemplateView):
@@ -395,7 +392,7 @@ class ParentChildListView(ViewPermissionCheckMixin, ObjectPermissionCheckMixin,
is_empty = len(self.object_list) == 0 is_empty = len(self.object_list) == 0
if is_empty: if is_empty:
raise Http404(_("Empty list and '%(class_name)s.allow_empty' is False.") raise Http404(_("Empty list and '%(class_name)s.allow_empty' is False.")
% {'class_name': self.__class__.__name__}) % {'class_name': self.__class__.__name__})
context = self.get_context_data(object=self.object) context = self.get_context_data(object=self.object)
return self.render_to_response(context) return self.render_to_response(context)

View File

@@ -98,23 +98,6 @@ class TextAreaDiv(forms.widgets.Widget):
return mark_safe(result) return mark_safe(result)
# From: http://www.peterbe.com/plog/emailinput-html5-django
class EmailInput(forms.widgets.Input):
"""
Class for a login form widget that accepts only well formated
email address
"""
input_type = 'email'
def render(self, name, value, attrs=None):
if attrs is None:
attrs = {}
attrs.update(dict(autocorrect='off',
autocapitalize='off',
spellcheck='false'))
return super(EmailInput, self).render(name, value, attrs=attrs)
class ScrollableCheckboxSelectMultiple(forms.widgets.CheckboxSelectMultiple): class ScrollableCheckboxSelectMultiple(forms.widgets.CheckboxSelectMultiple):
""" """
Class for a form widget composed of a selection of checkboxes wrapped Class for a form widget composed of a selection of checkboxes wrapped