Browse Source

[EmFieldGroup] Modification de la méthode fields + pep8/pylint

Roland Haroutiounian 9 years ago
parent
commit
06b5786c72
1 changed files with 9 additions and 8 deletions
  1. 9
    8
      EditorialModel/fieldgroups.py

+ 9
- 8
EditorialModel/fieldgroups.py View File

@@ -4,11 +4,12 @@ from EditorialModel.components import EmComponent
4 4
 from EditorialModel.classes import EmClass
5 5
 import EditorialModel.fieldtypes as ftypes
6 6
 from EditorialModel.fields import EmField
7
+from EditorialModel.model import Model
7 8
 
8
-# from Database import sqlutils
9
-# import sqlalchemy as sql
9
+#from Database import sqlutils
10
+#import sqlalchemy as sql
10 11
 
11
-# import EditorialModel
12
+#import EditorialModel
12 13
 
13 14
 
14 15
 ## Represents groups of EmField associated with an EmClass
@@ -38,9 +39,9 @@ class EmFieldGroup(EmComponent):
38 39
         fieldgroup_name = em_component_args['name']
39 40
         fieldgroup_class = em_component_args['class']
40 41
 
41
-        if not isinstance(name, str):
42
-            raise TypeError("Excepting <class str> as name. But got %s" % str(type(fielgroup_name)))
43
-        if not isinstance(em_class, EmClass):
42
+        if not isinstance(fieldgroup_name, str):
43
+            raise TypeError("Excepting <class str> as name. But got %s" % str(type(fieldgroup_name)))
44
+        if not isinstance(fieldgroup_class, EmClass):
44 45
             raise TypeError("Excepting <class EmClass> as em_class. But got %s" % str(type(fieldgroup_class)))
45 46
 
46 47
         return super(EmFieldGroup, cls).create(**em_component_args)
@@ -49,8 +50,8 @@ class EmFieldGroup(EmComponent):
49 50
     # @return A list of EmField instance
50 51
     def fields(self):
51 52
         result = []
52
-        for _,field in self.components[Model.name_from_emclass(EmField)]:
53
-            if field.fieldgroup_id==self.uid:
53
+        for _, field in self.components[Model.name_from_emclass(EmField)]:
54
+            if field.fieldgroup_id == self.uid:
54 55
                 result.append(field)
55 56
         return result
56 57
         # meta = sqlutils.meta(self.db_engine)

Loading…
Cancel
Save