Browse Source

Merge branch 't61'

Roland Haroutiounian 9 years ago
parent
commit
961dfe1ea3
2 changed files with 59 additions and 0 deletions
  1. 38
    0
      leobject/datasources/ledatasource.py
  2. 21
    0
      leobject/datasources/ledatasourcesql.py

+ 38
- 0
leobject/datasources/ledatasource.py View File

@@ -0,0 +1,38 @@
1
+#-*- coding: utf-8 -*-
2
+
3
+## Generic DataSource for LeObject
4
+
5
+class LeDataSource(object):
6
+
7
+    def __init__(self, options=None):
8
+        self.options = options
9
+
10
+
11
+    ## @brief update an existing LeObject
12
+    # @param lodel_id (int) : list of lodel_id
13
+    # @param checked_data dict
14
+    # @param datasource_filters (string)
15
+    def update(self, lodel_id, checked_data, datasource_filters):
16
+        return True
17
+
18
+    ## @brief insert
19
+    # @param typename string
20
+    # @param classname string
21
+    # @param **datas dict
22
+    def insert(self, typename, classname, **datas):
23
+        return True
24
+
25
+    ## @brief delete
26
+    # @param lodel_id (int) : list of lode_id(s) to delete
27
+    def delete(self, lodel_id):
28
+        return True
29
+    
30
+    ## @brief search for a collection of objects
31
+    # @param emclass LeClass : LeClass instance
32
+    # @param emtype LeType : LeType instance
33
+    # @param field_list list : list of fields to get from the datasource
34
+    # @param filters list : list of tuples formatted as (FIELD, OPERATOR, VALUE)
35
+    # @param relational_filters
36
+    def get(self, emclass, emtype, field_list, filters, relational_filters):
37
+        return {}
38
+

+ 21
- 0
leobject/datasources/ledatasourcesql.py View File

@@ -0,0 +1,21 @@
1
+#-*- coding: utf-8 -*-
2
+
3
+from ledatasource import LeDataSource
4
+from mosql.db import Database
5
+from Lodel.utils.mosql import *
6
+
7
+## SQL DataSource for LeObject
8
+class LeDataSourceSQL(LeDataSource):
9
+
10
+    def __init__(self, options=None):
11
+        super(LeDataSourceSQL, self).__init__()
12
+            
13
+        self.options = options
14
+
15
+    ## @brief search for a collection of objects
16
+    # @param emclass
17
+    # @param emtype
18
+    # @param filters list : list of tuples formatted as (FIELD, OPERATOR, VALUE)
19
+    # @param relational_filters
20
+    def get(self, emclass, emtype, field_list, filters, relational_filters):
21
+        pass

Loading…
Cancel
Save