|
@@ -10,6 +10,7 @@ import hashlib
|
10
|
10
|
import EditorialModel
|
11
|
11
|
from Lodel.utils.mlstring import MlString
|
12
|
12
|
|
|
13
|
+
|
13
|
14
|
## This class is the mother class of all editorial model objects
|
14
|
15
|
#
|
15
|
16
|
# It gather all the properties and mechanism that are common to every editorial model objects
|
|
@@ -70,7 +71,7 @@ class EmComponent(object):
|
70
|
71
|
uname = self.__class__.__name__
|
71
|
72
|
if not isinstance(self, EditorialModel.fields.EmField): # WARNING this could crash with fieldtypes
|
72
|
73
|
try:
|
73
|
|
- uname += '_' + self.em_class.name
|
|
74
|
+ uname += '_' + self.em_class.name # TODO Ajouter la propriété
|
74
|
75
|
except AttributeError:
|
75
|
76
|
pass
|
76
|
77
|
uname += '_' + self.name
|
|
@@ -144,7 +145,7 @@ class EmComponent(object):
|
144
|
145
|
# @return The max rank is the rank group or -1 if no components in that group
|
145
|
146
|
def get_max_rank(self):
|
146
|
147
|
same_rgroup = self.same_rank_group()
|
147
|
|
- return max([ comp.rank for comp in same_rgroup]) if len(same_rgroup) > 0 else -1
|
|
148
|
+ return max([comp.rank for comp in same_rgroup]) if len(same_rgroup) > 0 else -1
|
148
|
149
|
|
149
|
150
|
## Return an array of instances that are concerned by the same rank
|
150
|
151
|
# @return An array of instances that are concerned by the same rank
|
|
@@ -185,7 +186,7 @@ class EmComponent(object):
|
185
|
186
|
self.model.sort_components(self.__class__)
|
186
|
187
|
|
187
|
188
|
## Modify a rank given an integer modifier
|
188
|
|
- # @note this method always tries to make the modification : if modifier is too big put
|
|
189
|
+ # @note this method always tries to make the modification : if modifier is too big put
|
189
|
190
|
# the component in last position, if modifier is to small put the component
|
190
|
191
|
# in first position
|
191
|
192
|
# @param rank_mod int : can be a negative positive or zero integer
|
|
@@ -197,12 +198,12 @@ class EmComponent(object):
|
197
|
198
|
ret = True
|
198
|
199
|
new_rank = self.rank + rank_mod
|
199
|
200
|
if new_rank < 1:
|
200
|
|
- ret = False
|
201
|
|
- new_rank = 1
|
|
201
|
+ ret = False
|
|
202
|
+ new_rank = 1
|
202
|
203
|
elif new_rank > self.get_max_rank():
|
203
|
204
|
ret = False
|
204
|
205
|
new_rank = self.get_max_rank()
|
205
|
|
-
|
|
206
|
+
|
206
|
207
|
self.set_rank(new_rank)
|
207
|
208
|
return ret
|
208
|
209
|
|