|
@@ -5,6 +5,7 @@
|
5
|
5
|
|
6
|
6
|
from EditorialModel.components import EmComponent
|
7
|
7
|
from EditorialModel.classtypes import EmClassType
|
|
8
|
+from EditorialModel.types import EmType
|
8
|
9
|
import EditorialModel.fieldtypes as ftypes
|
9
|
10
|
import EditorialModel
|
10
|
11
|
|
|
@@ -28,19 +29,17 @@ class EmClass(EmComponent):
|
28
|
29
|
## EmClass instanciation
|
29
|
30
|
# @todo Classtype initialisation and test is not good EmClassType should give an answer or something like that
|
30
|
31
|
# @todo defines types check for icon and sortcolumn
|
31
|
|
- def __init__(self, model, uid, name, classtype, icon = '0', sortcolumn = 'rank', string = None, help_text = None, date_update = None, date_create = None, rank = None):
|
32
|
|
-
|
|
32
|
+ def __init__(self, model, uid, name, classtype, icon='0', sortcolumn='rank', string=None, help_text=None, date_update=None, date_create=None, rank=None):
|
|
33
|
+
|
33
|
34
|
try:
|
34
|
35
|
getattr(EmClassType, classtype)
|
35
|
36
|
except AttributeError:
|
36
|
|
- raise AttributeError("Unknown classtype '%s'" %classtype)
|
|
37
|
+ raise AttributeError("Unknown classtype '%s'" % classtype)
|
37
|
38
|
|
38
|
39
|
self.classtype = classtype
|
39
|
40
|
self.icon = icon
|
40
|
|
- self.sortcolumn = 'rank'
|
|
41
|
+ self.sortcolumn = sortcolumn # 'rank'
|
41
|
42
|
super(EmClass, self).__init__(model=model, uid=uid, name=name, string=string, help_text=help_text, date_update=date_update, date_create=date_create, rank=rank)
|
42
|
|
- pass
|
43
|
|
-
|
44
|
43
|
|
45
|
44
|
## Check if the EmComponent is valid
|
46
|
45
|
# @return True if valid False if not
|
|
@@ -86,7 +85,7 @@ class EmClass(EmComponent):
|
86
|
85
|
# @return types [EmType]:
|
87
|
86
|
def types(self):
|
88
|
87
|
ret = []
|
89
|
|
- for emtype in self.components(EmType):
|
|
88
|
+ for emtype in self.model.components(EmType):
|
90
|
89
|
if emtype.class_id == self.uid:
|
91
|
90
|
ret.append(emtype)
|
92
|
91
|
return ret
|
|
@@ -101,4 +100,3 @@ class EmClass(EmComponent):
|
101
|
100
|
# @return types [EmType]:
|
102
|
101
|
def linked_types(self):
|
103
|
102
|
pass
|
104
|
|
-
|