Browse Source

[PEP8] Nettoyage de Database/sqlutils.py

Roland Haroutiounian 9 years ago
parent
commit
1796990944
1 changed files with 14 additions and 1 deletions
  1. 14
    1
      Database/sqlutils.py

+ 14
- 1
Database/sqlutils.py View File

@@ -1,6 +1,6 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 import os
3
-import re
3
+#import re
4 4
 import logging as logger
5 5
 
6 6
 import sqlalchemy as sqla
@@ -25,6 +25,19 @@ ENGINES = {'mysql': {
25 25
 
26 26
 sqlcfg = settings.LODEL2SQLWRAPPER
27 27
 
28
+
29
+## Returns an engine given dbconf name
30
+#
31
+# @param ename str: name of an item in django.conf.settings.LODEL2SQLWRAPPER['db']
32
+# @param sqlaloggin None|bool: If None leave default value, if true activate sqlalchemy logging
33
+# @return SqlAlchemy engine
34
+def get_engine(ename='default',sqlalogging=None):
35
+    return getEngine(ename=ename, sqlalogging=sqlalogging)
36
+
37
+
38
+
39
+def db_engine(cls):
40
+    return sqlutils.getEngine(cls.dbconf)
28 41
 ## Return an engine given a dbconf name
29 42
 # @param ename str: Its a name of an item in django.conf.settings.LODEL2SQLWRAPPER['db']
30 43
 # @param sqlalogging None|bool : If None leave default value, if true activate sqlalchemy logging

Loading…
Cancel
Save