Browse Source

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

Roland Haroutiounian 9 years ago
parent
commit
d826611811
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      leobject/datasources/ledatasourcesql.py

+ 4
- 2
leobject/datasources/ledatasourcesql.py View File

42
     # @param emtype
42
     # @param emtype
43
     # @param filters list : list of tuples formatted as (FIELD, OPERATOR, VALUE)
43
     # @param filters list : list of tuples formatted as (FIELD, OPERATOR, VALUE)
44
     # @param relational_filters
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
         tablename =  emclass.name
47
         tablename =  emclass.name
48
         where_filters = self._prepare_filters(filters)
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
         query = select(tablename, where=where_filters, select=field_list)
51
         query = select(tablename, where=where_filters, select=field_list)
51
         self.db.execute(query)
52
         self.db.execute(query)
53
+
52
         return all_to_dicts(self.db)
54
         return all_to_dicts(self.db)
53
 
55
 
54
     # @brief prepares the filters to be used by the mosql library's functions
56
     # @brief prepares the filters to be used by the mosql library's functions

Loading…
Cancel
Save