| tierno | 5c01261 | 2018-04-19 16:01:59 +0200 | [diff] [blame] | 1 | from http import HTTPStatus |
| 2 | |
| 3 | __author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>" |
| 4 | |
| 5 | |
| 6 | class DbException(Exception): |
| 7 | |
| 8 | def __init__(self, message, http_code=HTTPStatus.NOT_FOUND): |
| 9 | self.http_code = http_code |
| 10 | Exception.__init__(self, "database exception " + message) |
| 11 | |
| 12 | |
| 13 | class DbBase(object): |
| 14 | |
| 15 | def __init__(self): |
| 16 | pass |
| 17 | |
| 18 | def db_connect(self, config): |
| 19 | pass |
| 20 | |
| 21 | def db_disconnect(self): |
| 22 | pass |
| 23 | |
| 24 | def get_list(self, table, filter={}): |
| 25 | pass |
| 26 | |
| 27 | def get_one(self, table, filter={}, fail_on_empty=True, fail_on_more=True): |
| 28 | pass |
| 29 | |
| 30 | def create(self, table, indata): |
| 31 | pass |
| 32 | |
| 33 | def del_list(self, table, filter={}): |
| 34 | pass |
| 35 | |
| 36 | def del_one(self, table, filter={}, fail_on_empty=True): |
| 37 | pass |