blob: a2768ae095d0100fb77e82df54174eee7fab6f40 [file] [log] [blame]
tierno6ce7cc82018-01-29 18:44:04 +01001
2
3class DbException(Exception):
4
5 def __init__(self, message, http_code=404):
tierno0aef0db2018-02-01 19:13:07 +01006 # TODO change to http.HTTPStatus instead of int that allows .value and .name
tierno6ce7cc82018-01-29 18:44:04 +01007 self.http_code = http_code
8 Exception.__init__(self, message)
9
tierno0aef0db2018-02-01 19:13:07 +010010
tierno6ce7cc82018-01-29 18:44:04 +010011class dbbase(object):
12
13 def __init__(self):
14 pass
15
16 def db_connect(self, config):
17 pass
18
19 def db_disconnect(self):
20 pass
21
22 def get_list(self, table, filter={}):
23 pass
24
25 def get_one(self, table, filter={}, fail_on_empty=True, fail_on_more=True):
26 pass
27
28 def create(self, table, indata):
29 pass
30
31 def del_list(self, table, filter={}):
32 pass
33
34 def del_one(self, table, filter={}, fail_on_empty=True):
35 pass