diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2010-08-09 21:22:37 +0000 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2010-08-09 21:22:37 +0000 |
commit | 6001ba016a3db4701d56abc6d30868d4e5d88dbf (patch) | |
tree | 7a42c57d802484300c2384d3cd3a968de1804383 /django/db/backends/creation.py | |
parent | c7bd48cb9f645e5ff07d1e68b86130e3bb2b043f (diff) | |
download | django-soc2010/query-refactor.tar.gz |
[soc2010/query-refactor] Merged up to trunk r13556, resolved merge conflictsarchive/soc2010/query-refactorsoc2010/query-refactor
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/query-refactor@13565 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/creation.py')
-rw-r--r-- | django/db/backends/creation.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/django/db/backends/creation.py b/django/db/backends/creation.py index 999d1cb5fe..c10ad9da31 100644 --- a/django/db/backends/creation.py +++ b/django/db/backends/creation.py @@ -359,12 +359,17 @@ class BaseDatabaseCreation(object): can_rollback = self._rollback_works() self.connection.settings_dict["SUPPORTS_TRANSACTIONS"] = can_rollback - call_command('syncdb', verbosity=verbosity, interactive=False, database=self.connection.alias) + # Report syncdb messages at one level lower than that requested. + # This ensures we don't get flooded with messages during testing + # (unless you really ask to be flooded) + call_command('syncdb', verbosity=max(verbosity - 1, 0), interactive=False, database=self.connection.alias) if settings.CACHE_BACKEND.startswith('db://'): - from django.core.cache import parse_backend_uri - _, cache_name, _ = parse_backend_uri(settings.CACHE_BACKEND) - call_command('createcachetable', cache_name) + from django.core.cache import parse_backend_uri, cache + from django.db import router + if router.allow_syncdb(self.connection.alias, cache.cache_model_class): + _, cache_name, _ = parse_backend_uri(settings.CACHE_BACKEND) + call_command('createcachetable', cache_name, database=self.connection.alias) # Get a cursor (even though we don't need one yet). This has # the side effect of initializing the test database. @@ -397,10 +402,8 @@ class BaseDatabaseCreation(object): if autoclobber or confirm == 'yes': try: if verbosity >= 1: - print "Destroying old test database..." + print "Destroying old test database '%s'..." % self.connection.alias cursor.execute("DROP DATABASE %s" % qn(test_database_name)) - if verbosity >= 1: - print "Creating test database..." cursor.execute("CREATE DATABASE %s %s" % (qn(test_database_name), suffix)) except Exception, e: sys.stderr.write("Got an error recreating the test database: %s\n" % e) |