summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/base.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2008-08-11 12:11:25 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2008-08-11 12:11:25 +0000
commit9dc4ba875f21d5690f6ad5995123a67a3c44bafe (patch)
tree621f876758ac16dceee95faf51973d4b05f1c830 /django/db/backends/postgresql/base.py
parentcec69eb70d1e2f84dc5a7fb172da88a79b0f5063 (diff)
Fixed #5461 -- Refactored the database backend code to use classes for the creation and introspection modules. Introduces a new validation module for DB-specific validation. This is a backwards incompatible change; see the wiki for details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8296 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/postgresql/base.py')
-rw-r--r--django/db/backends/postgresql/base.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py
index 1dfe34aceb..4a8d6ebef0 100644
--- a/django/db/backends/postgresql/base.py
+++ b/django/db/backends/postgresql/base.py
@@ -4,9 +4,13 @@ PostgreSQL database backend for Django.
Requires psycopg 1: http://initd.org/projects/psycopg1
"""
-from django.utils.encoding import smart_str, smart_unicode
-from django.db.backends import BaseDatabaseWrapper, BaseDatabaseFeatures, util
+from django.db.backends import *
+from django.db.backends.postgresql.client import DatabaseClient
+from django.db.backends.postgresql.creation import DatabaseCreation
+from django.db.backends.postgresql.introspection import DatabaseIntrospection
from django.db.backends.postgresql.operations import DatabaseOperations
+from django.utils.encoding import smart_str, smart_unicode
+
try:
import psycopg as Database
except ImportError, e:
@@ -59,12 +63,7 @@ class UnicodeCursorWrapper(object):
def __iter__(self):
return iter(self.cursor)
-class DatabaseFeatures(BaseDatabaseFeatures):
- pass # This backend uses all the defaults.
-
class DatabaseWrapper(BaseDatabaseWrapper):
- features = DatabaseFeatures()
- ops = DatabaseOperations()
operators = {
'exact': '= %s',
'iexact': 'ILIKE %s',
@@ -82,6 +81,16 @@ class DatabaseWrapper(BaseDatabaseWrapper):
'iendswith': 'ILIKE %s',
}
+ def __init__(self, *args, **kwargs):
+ super(DatabaseWrapper, self).__init__(*args, **kwargs)
+
+ self.features = BaseDatabaseFeatures()
+ self.ops = DatabaseOperations()
+ self.client = DatabaseClient()
+ self.creation = DatabaseCreation(self)
+ self.introspection = DatabaseIntrospection(self)
+ self.validation = BaseDatabaseValidation()
+
def _cursor(self, settings):
set_tz = False
if self.connection is None: