瀏覽代碼

[#61] Added the case of a non given relational_filters argument

Roland Haroutiounian 9 年之前
父節點
當前提交
d826611811
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4
    2
      leobject/datasources/ledatasourcesql.py

+ 4
- 2
leobject/datasources/ledatasourcesql.py 查看文件

@@ -42,13 +42,15 @@ class LeDataSourceSQL(DummyDatasource):
42 42
     # @param emtype
43 43
     # @param filters list : list of tuples formatted as (FIELD, OPERATOR, VALUE)
44 44
     # @param relational_filters
45
-    def get(self, emclass, emtype, field_list, filters, relational_filters):
45
+    def get(self, emclass, emtype, field_list, filters, relational_filters=None):
46 46
 
47 47
         tablename =  emclass.name
48 48
         where_filters = self._prepare_filters(filters)
49
-        rel_filters = self._prepare_filters(relational_filters)
49
+        if relational_filters or len(relational_filters) > 0:
50
+            rel_filters = self._prepare_filters(relational_filters)
50 51
         query = select(tablename, where=where_filters, select=field_list)
51 52
         self.db.execute(query)
53
+
52 54
         return all_to_dicts(self.db)
53 55
 
54 56
     # @brief prepares the filters to be used by the mosql library's functions

Loading…
取消
儲存