mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 23:02:19 +00:00
Switch SSO Service API layer to use the new Django 1.2 ORM layer
This commit is contained in:
@@ -73,17 +73,7 @@ class BaseDBService(BaseService):
|
||||
@property
|
||||
def db(self):
|
||||
if not hasattr(self, '_db'):
|
||||
# Use the master DB settings, bar the database name
|
||||
backend = load_backend(settings.DATABASE_ENGINE)
|
||||
self._db = backend.DatabaseWrapper({
|
||||
'DATABASE_HOST': settings.DATABASE_HOST,
|
||||
'DATABASE_NAME': self.settings['database_name'],
|
||||
'DATABASE_OPTIONS': {},
|
||||
'DATABASE_PASSWORD': settings.DATABASE_PASSWORD,
|
||||
'DATABASE_PORT': settings.DATABASE_PORT,
|
||||
'DATABASE_USER': settings.DATABASE_USER,
|
||||
'TIME_ZONE': settings.TIME_ZONE,})
|
||||
|
||||
self._db = connections[self.settings['database_name']]
|
||||
return self._db
|
||||
|
||||
@property
|
||||
@@ -92,9 +82,3 @@ class BaseDBService(BaseService):
|
||||
self._dbcursor = self.db.cursor()
|
||||
return self._dbcursor
|
||||
|
||||
def __del__(self):
|
||||
if hasattr(self, '_db'):
|
||||
self.db.connection.commit()
|
||||
self.db.close()
|
||||
self.db = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user