Browse Source

[EditorialModel/classtypes.py] PEP8

Roland Haroutiounian 9 years ago
parent
commit
d0d9ef6ecd
2 changed files with 48 additions and 39 deletions
  1. 47
    38
      EditorialModel/classtypes.py
  2. 1
    1
      EditorialModel/fieldgroups.py

+ 47
- 38
EditorialModel/classtypes.py View File

1
 # -*- coding: utf-8 -*-
1
 # -*- coding: utf-8 -*-
2
 
2
 
3
-## constant name for the nature of type hierarchy
3
+
4
+## EmNature (Class)
5
+#
6
+# constant name for the nature of type hierarchy
4
 class EmNature(object):
7
 class EmNature(object):
5
     PARENT = 'parent'
8
     PARENT = 'parent'
6
     TRANSLATION = 'translation'
9
     TRANSLATION = 'translation'
7
     IDENTITY = 'identity'
10
     IDENTITY = 'identity'
8
 
11
 
9
-##  Representation of the classTypes
12
+
13
+## EmClassType (Class)
14
+#
15
+# Representation of the classTypes
10
 #
16
 #
11
 #    Defines 3 generic classtype : entity, entry and person
17
 #    Defines 3 generic classtype : entity, entry and person
12
 #        - entity : to define editorial content
18
 #        - entity : to define editorial content
26
 class EmClassType(object):
32
 class EmClassType(object):
27
 
33
 
28
     entity = {
34
     entity = {
29
-        'name' : 'entity',
30
-        'hierarchy' : {
31
-            EmNature.PARENT : {
32
-                'attach'   : 'classtype',
33
-                'automatic' : False,
34
-                'maxdepth' : -1,
35
-                'maxchildren' : -1
36
-                },
37
-            EmNature.TRANSLATION : {
38
-                'attach'   : 'type',
39
-                'automatic' : False,
40
-                'maxdepth' : 1,
41
-                'maxchildren' : -1
42
-                },
35
+        'name': 'entity',
36
+        'hierarchy': {
37
+            EmNature.PARENT: {
38
+                'attach': 'classtype',
39
+                'automatic': False,
40
+                'maxdepth': -1,
41
+                'maxchildren': -1
42
+            },
43
+            EmNature.TRANSLATION: {
44
+                'attach': 'type',
45
+                'automatic': False,
46
+                'maxdepth': 1,
47
+                'maxchildren': -1
48
+            },
43
         },
49
         },
44
     }
50
     }
45
 
51
 
46
     entry = {
52
     entry = {
47
-        'name' : 'entry',
48
-        'hierarchy' : {
49
-            EmNature.PARENT : {
50
-                'attach'   : 'type',
51
-                'automatic' : False,
52
-                },
53
-            EmNature.TRANSLATION : {
54
-                'attach'   : 'type',
55
-                'automatic' : False,
56
-                'maxdepth' : 1,
57
-                'maxchildren' : -1
58
-                },
53
+        'name': 'entry',
54
+        'hierarchy': {
55
+            EmNature.PARENT: {
56
+                'attach': 'type',
57
+                'automatic': False,
58
+            },
59
+            EmNature.TRANSLATION: {
60
+                'attach': 'type',
61
+                'automatic': False,
62
+                'maxdepth': 1,
63
+                'maxchildren': -1
64
+            },
59
         },
65
         },
60
     }
66
     }
61
 
67
 
62
     person = {
68
     person = {
63
-        'name' : 'person',
64
-        'hierarchy' : {
65
-            EmNature.IDENTITY : {
66
-                'attach'   : 'classtype',
67
-                'automatic' : True,
68
-                'maxdepth' : -1,
69
-                'maxchildren' : 1
69
+        'name': 'person',
70
+        'hierarchy': {
71
+            EmNature.IDENTITY: {
72
+                'attach': 'classtype',
73
+                'automatic': True,
74
+                'maxdepth': -1,
75
+                'maxchildren': 1
70
             },
76
             },
71
         },
77
         },
72
     }
78
     }
73
 
79
 
74
-    @staticmethod
75
-    ## Return possible nature of relations for a classtype name
80
+    ## natures (Method)
81
+    #
82
+    # Return possible nature of relations for a classtype name
83
+    #
76
     # @param classtype str: The classtype name
84
     # @param classtype str: The classtype name
77
-    # @reurn A list of EmNature names (list of str)
85
+    # @return A list of EmNature names (list of str)
86
+    @staticmethod
78
     def natures(classtype_name):
87
     def natures(classtype_name):
79
         if not isinstance(classtype_name, str):
88
         if not isinstance(classtype_name, str):
80
             raise TypeError("Excepted <class str> but got "+str(type(classtype_name)))
89
             raise TypeError("Excepted <class str> but got "+str(type(classtype_name)))

+ 1
- 1
EditorialModel/fieldgroups.py View File

64
     def fields(self):
64
     def fields(self):
65
         field_table = sqlutils.getTable(EditorialModel.fields.EmField)
65
         field_table = sqlutils.getTable(EditorialModel.fields.EmField)
66
         req = field_table.select(field_table.c.uid).where(field_table.c.fieldgroup_id == self.uid)
66
         req = field_table.select(field_table.c.uid).where(field_table.c.fieldgroup_id == self.uid)
67
-        conn = self.__class__.getDbE().connect()
67
+        conn = self.__class__.db_engine().connect()
68
         res = conn.execute(req)
68
         res = conn.execute(req)
69
         rows = res.fetchall()
69
         rows = res.fetchall()
70
         conn.close()
70
         conn.close()

Loading…
Cancel
Save