Browse Source

Implements LeType.add_superior()

Yann Weber 9 years ago
parent
commit
3fe8e3e1ef
1 changed files with 7 additions and 5 deletions
  1. 7
    5
      leobject/letype.py

+ 7
- 5
leobject/letype.py View File

@@ -160,11 +160,13 @@ class LeType(object):
160 160
         return self._datasource.del_related(sup, sub)
161 161
     
162 162
     ## @brief Add a superior
163
-    # @param lesup LeType : LeType child class instance that will be the superior
164
-    # @param nature str : @ref EditorialModel.classtypes
165
-    # @return True if add with no problems
166
-    def add_superior(self, lesup, nature):
167
-        self._datasource.add_superior(lesub, self)
163
+    # @param lesup LeType | LeRoot : LeType child class instance that will be the superior
164
+    # @param nature str : The nature of the relation @ref EditorialModel.classtypes
165
+    # @param rank str|int :  The relation rank. Can be 'last', 'first' or an integer
166
+    # @param replace_if_exists bool : if True delete the old superior and set the new one. If False and there is a superior raise an LeObjectQueryError
167
+    # @return The relation ID or False if fails
168
+    def add_superior(self, leo, nature, rank = 'last', replace_if_exists = False):
169
+        return leobject.lefactory.LeFactory.leobj_from_name('LeObject').hierarchy_add(leo, self, nature, rank, replace_if_exists)
168 170
         
169 171
     
170 172
     ## @brief Delete a LeType from the datasource

Loading…
Cancel
Save