Browse Source

[Untested] Apply abtract LeObject child class generalisation for delete & update methods of mongoDB datasource

Yann Weber 8 years ago
parent
commit
29d6c0fcf2
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      plugins/mongodb_datasource/datasource.py

+ 10
- 0
plugins/mongodb_datasource/datasource.py View File

@@ -184,6 +184,11 @@ ordering is not implemented yet")
184 184
     #@param relational_filters list : List of relational filters
185 185
     #@return int : number of deleted records
186 186
     def delete(self, target, filters, relational_filters):
187
+        if target.is_asbtract():
188
+            #Deletion with abstract LeObject as target (reccursiv calls)
189
+            return self.__act_on_abstract(target, filters,
190
+                relational_filters, self.delete)
191
+        #Non abstract beahavior
187 192
         mongo_filters = self.__process_filters(
188 193
             target, filters, relational_filters)
189 194
         res = self.__collection(target).delete_many(mongo_filters)
@@ -196,6 +201,11 @@ ordering is not implemented yet")
196 201
     #@param upd_datas dict : datas to update (new values)
197 202
     #@return int : Number of updated records
198 203
     def update(self, target, filters, relational_filters, upd_datas):
204
+        if target.is_asbtract():
205
+            #Update using abstract LeObject as target (reccursiv calls)
206
+            return self.__act_on_abstract(target, filters,
207
+                relational_filters, self.update, upd_datas = upd_datas)
208
+        #Non abstract beahavior
199 209
         mongo_filters = self.__process_filters(
200 210
             target, filters, relational_filters)
201 211
         res = self.__collection(target).update_many(mongo_filters, upd_datas)

Loading…
Cancel
Save