diff options
Diffstat (limited to 'django/db/backends/sqlite3')
| -rw-r--r-- | django/db/backends/sqlite3/base.py | 16 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/client.py | 2 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/creation.py | 11 |
3 files changed, 12 insertions, 17 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index f9be87d00a..6f78cf2a4a 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -29,10 +29,6 @@ except ImportError, exc: module = 'either pysqlite2 or sqlite3 modules (tried in that order)' raise ImproperlyConfigured, "Error loading %s: %s" % (module, exc) -try: - import decimal -except ImportError: - from django.utils import _decimal as decimal # for Python 2.3 DatabaseError = Database.DatabaseError IntegrityError = Database.IntegrityError @@ -154,19 +150,19 @@ class DatabaseWrapper(BaseDatabaseWrapper): self.client = DatabaseClient(self) self.creation = DatabaseCreation(self) self.introspection = DatabaseIntrospection(self) - self.validation = BaseDatabaseValidation() + self.validation = BaseDatabaseValidation(self) def _cursor(self): if self.connection is None: settings_dict = self.settings_dict - if not settings_dict['DATABASE_NAME']: + if not settings_dict['NAME']: from django.core.exceptions import ImproperlyConfigured - raise ImproperlyConfigured, "Please fill out DATABASE_NAME in the settings module before using the database." + raise ImproperlyConfigured, "Please fill out the database NAME in the settings module before using the database." kwargs = { - 'database': settings_dict['DATABASE_NAME'], + 'database': settings_dict['NAME'], 'detect_types': Database.PARSE_DECLTYPES | Database.PARSE_COLNAMES, } - kwargs.update(settings_dict['DATABASE_OPTIONS']) + kwargs.update(settings_dict['OPTIONS']) self.connection = Database.connect(**kwargs) # Register extract, date_trunc, and regexp functions. self.connection.create_function("django_extract", 2, _sqlite_extract) @@ -179,7 +175,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): # If database is in memory, closing the connection destroys the # database. To prevent accidental data loss, ignore close requests on # an in-memory db. - if self.settings_dict['DATABASE_NAME'] != ":memory:": + if self.settings_dict['NAME'] != ":memory:": BaseDatabaseWrapper.close(self) class SQLiteCursorWrapper(Database.Cursor): diff --git a/django/db/backends/sqlite3/client.py b/django/db/backends/sqlite3/client.py index 8836b09899..5b5b7326f2 100644 --- a/django/db/backends/sqlite3/client.py +++ b/django/db/backends/sqlite3/client.py @@ -8,7 +8,7 @@ class DatabaseClient(BaseDatabaseClient): def runshell(self): args = [self.executable_name, - self.connection.settings_dict['DATABASE_NAME']] + self.connection.settings_dict['NAME']] if os.name == 'nt': sys.exit(os.system(" ".join(args))) else: diff --git a/django/db/backends/sqlite3/creation.py b/django/db/backends/sqlite3/creation.py index fb27d22cf3..03897078a2 100644 --- a/django/db/backends/sqlite3/creation.py +++ b/django/db/backends/sqlite3/creation.py @@ -1,6 +1,5 @@ import os import sys -from django.conf import settings from django.db.backends.creation import BaseDatabaseCreation class DatabaseCreation(BaseDatabaseCreation): @@ -30,7 +29,7 @@ class DatabaseCreation(BaseDatabaseCreation): 'TextField': 'text', 'TimeField': 'time', } - + def sql_for_pending_references(self, model, style, pending_references): "SQLite3 doesn't support constraints" return [] @@ -38,10 +37,10 @@ class DatabaseCreation(BaseDatabaseCreation): def sql_remove_table_constraints(self, model, references_to_delete, style): "SQLite3 doesn't support constraints" return [] - + def _create_test_db(self, verbosity, autoclobber): - if settings.TEST_DATABASE_NAME and settings.TEST_DATABASE_NAME != ":memory:": - test_database_name = settings.TEST_DATABASE_NAME + test_database_name = self.connection.settings_dict['TEST_NAME'] + if test_database_name and test_database_name != ":memory:": # Erase the old test database if verbosity >= 1: print "Destroying old test database..." @@ -64,7 +63,7 @@ class DatabaseCreation(BaseDatabaseCreation): else: test_database_name = ":memory:" return test_database_name - + def _destroy_test_db(self, test_database_name, verbosity): if test_database_name and test_database_name != ":memory:": # Remove the SQLite database file |
