Browse Source

[#61] Rewriting the method headers

Roland Haroutiounian 9 years ago
parent
commit
dcd65f5f4c
1 changed files with 31 additions and 16 deletions
  1. 31
    16
      leobject/datasources/ledatasourcesql.py

+ 31
- 16
leobject/datasources/ledatasourcesql.py View File

@@ -14,36 +14,51 @@ class LeDataSourceSQL(DummyDatasource):
14 14
         self.db = Database(self.module, self.conn_args, self.conn_kargs)
15 15
 
16 16
     ## @brief update an existing object's data
17
-    # @param lodel_id int : lodel_id of the object to update
18
-    # @param checked_data dict
19
-    # @param filters
20
-    # @param relational_filters
21
-    def update (self, lodel_id, checked_data, filters, relational_filters):
17
+    # @param leclass LeClass
18
+    # @param filters list : list of tuples formatted as (FIELD, OPERATOR, VALUE)
19
+    # @param data dict
20
+    # @param relational_filters list : list of tuples formatted as (('superior'|'subordinate', FIELD), OPERATOR, VALUE)
21
+    # @param letype LeType
22
+    # @return bool
23
+    def update (self, leclass, filters, data, relational_filters=None, letype=None):
22 24
         pass
23 25
 
24 26
     ## @brief create a new object in the datasource
25
-    # @param letype LeType
26 27
     # @param leclass LeClass
27
-    # @param data dict : dictionnary of field:value pairs to save
28
-    # @return lodel_id int : lodel_id of the created object
29
-    def insert(self, letype, leclass, **data):
28
+    # @param letype LeType
29
+    # @param datas dict : dictionnary of field:value pairs to save
30
+    # @return int : lodel_id of the created object
31
+    def insert(self, leclass, letype=None, **datas):
30 32
         pass
31 33
 
32 34
     ## @brief delete an existing object
33
-    # @param lodel_id int : lodel_id of the object to delete
34
-    # @param filters list : list of typles formatted as (FIELD, OPERATOR, VALUE)
35
-    # @param relational_filters list
35
+    # @param leclass LeClass
36
+    # @param filters list : list of tuples formatted as (FIELD, OPERATOR, VALUE)
37
+    # @param relational_filters list : list of tuples formatted as (('superior'|'subordinate', FIELD), OPERATOR, VALUE)
38
+    # @param letype LeType
36 39
     # @return bool : True on success
37
-    def delete(self, lodel_id, filters, relational_filters):
40
+    def delete(self, leclass, filters, relational_filters=None, letype=None):
38 41
         pass
39 42
 
40 43
     ## @brief search for a collection of objects
41
-    # @param emclass
42
-    # @param emtype
44
+    # @param emclass LeClass
45
+    # @param emtype LeType
46
+    # @field_list list
43 47
     # @param filters list : list of tuples formatted as (FIELD, OPERATOR, VALUE)
44
-    # @param relational_filters
48
+    # @param relational_filters list : list of tuples formatted as (('superior'|'subordinate', FIELD), OPERATOR, VALUE)
45 49
     def get(self, emclass, emtype, field_list, filters, relational_filters=None):
46 50
 
51
+        tablename = emclass.name
52
+        where_filters = self._prepare_filters(filters)
53
+        if relational_filters or len(relational_filters) > 0:
54
+            for relational_filter in relational_filters:
55
+                relational_position = relational_filter[0][0]
56
+                relational_field = relational_filter[0][1]
57
+                relational_operator = relational_filter[1]
58
+                relational_value = relational_filter[2]
59
+
60
+
61
+
47 62
         tablename =  emclass.name
48 63
         where_filters = self._prepare_filters(filters)
49 64
         if relational_filters or len(relational_filters) > 0:

Loading…
Cancel
Save