Преглед на файлове

Bugfixe in MongoDb datasource

Pymongo do not handles sets as value. We have to cast them into lists
done only in update for the moment...
Yann Weber преди 8 години
родител
ревизия
df45f318d4
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. 6
    0
      plugins/mongodb_datasource/datasource.py

+ 6
- 0
plugins/mongodb_datasource/datasource.py Целия файл

@@ -222,6 +222,12 @@ abstract, preparing reccursiv calls" % (target, filters, relational_filters))
222 222
     #@param upd_datas dict : datas to update (new values)
223 223
     #@return int : Number of updated records
224 224
     def update(self, target, filters, relational_filters, upd_datas):
225
+        for dname in upd_datas:
226
+            if isinstance(upd_datas[dname], set):
227
+                #pymongo raises :
228
+                #bson.errors.InvalidDocument: Cannot encode object: {...}
229
+                #with sets
230
+                upd_datas[dname] = list(upd_datas[dname])
225 231
         res = self.__update_no_backref(target, filters, relational_filters,
226 232
             upd_datas)
227 233
         self.__update_backref_filtered(target, filters, relational_filters,

Loading…
Отказ
Запис