|
@@ -8,7 +8,7 @@
|
8
|
8
|
class EmComponent(object):
|
9
|
9
|
|
10
|
10
|
## instaciate an EmComponent
|
11
|
|
- # @param id_or_name <int> || <str>
|
|
11
|
+ # @param int|str id_or_name
|
12
|
12
|
# @raise TypeError
|
13
|
13
|
def __init(id_or_name):
|
14
|
14
|
if id_or_name is int:
|
|
@@ -25,28 +25,50 @@ class EmComponent(object):
|
25
|
25
|
where = "name = " + db.quote(self.name)
|
26
|
26
|
else:
|
27
|
27
|
where = "id = " + self.id
|
28
|
|
-
|
|
28
|
+
|
29
|
29
|
row = db.query(where)
|
30
|
30
|
if not row:
|
31
|
31
|
# could have two possible Error message for id and for name
|
32
|
32
|
raise EmComponentNotExistError("Bad id_or_name: could not find the component")
|
33
|
|
-
|
|
33
|
+
|
34
|
34
|
self.name = row.name
|
35
|
35
|
self.rank = row.rank
|
36
|
36
|
self.date_update = row.date_update
|
37
|
|
- self.date_create <datetime object>
|
|
37
|
+ self.date_create = row.date_create
|
38
|
38
|
self.string <MlString object> : string representation of the component
|
39
|
39
|
self.help <MlString object> : help string
|
40
|
40
|
self.icon <string> : path to the icon (should be id_global of EmFile object)
|
41
|
41
|
|
42
|
|
- @static_method
|
43
|
|
- def id_from_name(name):
|
44
|
|
-
|
45
|
|
- @staticmethod
|
46
|
|
- def create(name <string>, parent_component <EmComponent object>)
|
47
|
|
- def save(self)
|
48
|
|
- def delete(self)
|
49
|
|
- def modify_rank(self)
|
50
|
|
- def set_string(self, lang, texte)
|
51
|
|
- def set_strings(self)
|
52
|
|
- def get_string(self, lang)
|
|
42
|
+ ## write the representation of the component in the database
|
|
43
|
+ # @return bool
|
|
44
|
+ def save(self):
|
|
45
|
+ pass
|
|
46
|
+
|
|
47
|
+ ## delete this component in the database
|
|
48
|
+ # @return bool
|
|
49
|
+ def delete(self):
|
|
50
|
+ pass
|
|
51
|
+
|
|
52
|
+ ## change the rank of the component
|
|
53
|
+ # @param int new_rank new position
|
|
54
|
+ def modify_rank(self, new_rank):
|
|
55
|
+ pass
|
|
56
|
+
|
|
57
|
+ ## set a string representation of the component for a given language
|
|
58
|
+ # @param str lang iso 639-2 representation of the language http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
|
|
59
|
+ # @param str text
|
|
60
|
+ # @return bool
|
|
61
|
+ def set_string(self, lang, text):
|
|
62
|
+ pass
|
|
63
|
+
|
|
64
|
+ ## set the string representation of the component
|
|
65
|
+ # @param MlString ml_string strings for all language
|
|
66
|
+ # @return bool
|
|
67
|
+ def set_strings(self, ml_string):
|
|
68
|
+ pass
|
|
69
|
+
|
|
70
|
+ ## get the string representation of the component for the given language
|
|
71
|
+ # @param str lang iso 639-2 representation of the language
|
|
72
|
+ # @return str
|
|
73
|
+ def get_string(self, lang):
|
|
74
|
+ pass
|