pep8 bits
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 11 Feb 2016 10:03:51 +0100
changeset 11131 2dafcdd19c99
parent 11130 9b8dcde03499
child 11135 421520f4d516
pep8 bits
cubicweb/web/formfields.py
cubicweb/web/views/forms.py
--- a/cubicweb/web/formfields.py	Thu Feb 11 10:03:31 2016 +0100
+++ b/cubicweb/web/formfields.py	Thu Feb 11 10:03:51 2016 +0100
@@ -63,7 +63,6 @@
 """
 __docformat__ = "restructuredtext en"
 
-from warnings import warn
 from datetime import datetime, timedelta
 
 from six import PY2, text_type, string_types
@@ -79,36 +78,39 @@
                               FormatConstraint)
 
 from cubicweb import Binary, tags, uilib, neg_role
-from cubicweb.utils import support_args
-from cubicweb.web import INTERNAL_FIELD_VALUE, ProcessFormError, eid_param, \
-     formwidgets as fw
+from cubicweb.web import (INTERNAL_FIELD_VALUE, ProcessFormError, eid_param,
+                          formwidgets as fw)
 from cubicweb.web.views import uicfg
 
+
 class UnmodifiedField(Exception):
     """raise this when a field has not actually been edited and you want to skip
     it
     """
 
+
 def normalize_filename(filename):
     return filename.split('\\')[-1]
 
+
 def vocab_sort(vocab):
     """sort vocabulary, considering option groups"""
     result = []
     partresult = []
     for label, value in vocab:
-        if value is None: # opt group start
+        if value is None:  # opt group start
             if partresult:
                 result += sorted(partresult)
                 partresult = []
-            result.append( (label, value) )
+            result.append((label, value))
         else:
-            partresult.append( (label, value) )
+            partresult.append((label, value))
     result += sorted(partresult)
     return result
 
 _MARKER = nullobject()
 
+
 class Field(object):
     """This class is the abstract base class for all fields. It hold a bunch
     of attributes which may be used for fine control of the behaviour of a
@@ -480,7 +482,7 @@
         return self._ensure_correctly_typed(form, value)
 
     def _ensure_correctly_typed(self, form, value):
-        """widget might to return date as a correctly formatted string or as
+        """widget might return e.g. a date as a correctly formatted string or as
         correctly typed objects, but process_for_value must return a typed value.
         Override this method to type the value if necessary
         """
--- a/cubicweb/web/views/forms.py	Thu Feb 11 10:03:31 2016 +0100
+++ b/cubicweb/web/views/forms.py	Thu Feb 11 10:03:51 2016 +0100
@@ -312,7 +312,7 @@
         try:
             return super(EntityFieldsForm, cls_or_self).field_by_name(name, role)
         except form.FieldNotFound:
-            if eschema is None or role is None or not name in eschema.schema:
+            if eschema is None or role is None or name not in eschema.schema:
                 raise
             rschema = eschema.schema.rschema(name)
             # XXX use a sample target type. Document this.
@@ -325,7 +325,7 @@
                 kwargs = {}
             if fieldcls:
                 if not isinstance(fieldcls, type):
-                    return fieldcls # already and instance
+                    return fieldcls  # already and instance
                 return fieldcls(name=name, role=role, eidparam=True, **kwargs)
             if isinstance(cls_or_self, type):
                 req = None