Author: Alex
Date: 2009-11-26 01:26:05 -0600 (Thu, 26 Nov 2009)
New Revision: 11779

Modified:
   django/branches/soc2009/multidb/TODO
   django/branches/soc2009/multidb/django/db/__init__.py
   django/branches/soc2009/multidb/django/db/utils.py
Log:
[soc2009/multidb] Fix a number of tests when run under an old style settings 
(i.e. using the DATABASE_* settings).

Modified: django/branches/soc2009/multidb/TODO
===================================================================
--- django/branches/soc2009/multidb/TODO        2009-11-23 21:40:09 UTC (rev 
11778)
+++ django/branches/soc2009/multidb/TODO        2009-11-26 07:26:05 UTC (rev 
11779)
@@ -11,6 +11,15 @@
     * validate() on a field
         * name/purpose clash with Honza?
         * any overlap with existing methods?
+ * Check test failures with old-style (non-multi-db) settings file
+    * custom_pk
+    * backends
+ * Check test failures with MySQL MyISAM
+    * serializers_regress
+    * fixtures
+    * lookup
+    * transactions
+    * model_regress
 
 Optional for v1.2
 ~~~~~~~~~~~~~~~~~

Modified: django/branches/soc2009/multidb/django/db/__init__.py
===================================================================
--- django/branches/soc2009/multidb/django/db/__init__.py       2009-11-23 
21:40:09 UTC (rev 11778)
+++ django/branches/soc2009/multidb/django/db/__init__.py       2009-11-26 
07:26:05 UTC (rev 11779)
@@ -17,9 +17,19 @@
         "settings.DATABASE_* is deprecated; use settings.DATABASES instead.",
         PendingDeprecationWarning
     )
+    
+    if settings.DATABASE_ENGINE in ("postgresql", "postgresql_psycopg2",
+        "sqlite3", "mysql", "oracle"):
+        engine = "django.db.backends.%s" % settings.DATABASE_ENGINE
+        warnings.warn(
+            "Short names for DATABASE_ENGINE are deprecated; prepend with 
'django.db.backends.'",
+            PendingDeprecationWarning
+        )
+    else:
+        engine = settings.DATABASE_ENGINE
 
     settings.DATABASES[DEFAULT_DB_ALIAS] = {
-        'ENGINE': settings.DATABASE_ENGINE,
+        'ENGINE': engine,
         'HOST': settings.DATABASE_HOST,
         'NAME': settings.DATABASE_NAME,
         'OPTIONS': settings.DATABASE_OPTIONS,

Modified: django/branches/soc2009/multidb/django/db/utils.py
===================================================================
--- django/branches/soc2009/multidb/django/db/utils.py  2009-11-23 21:40:09 UTC 
(rev 11778)
+++ django/branches/soc2009/multidb/django/db/utils.py  2009-11-26 07:26:05 UTC 
(rev 11779)
@@ -6,13 +6,7 @@
 
 def load_backend(backend_name):
     try:
-        module = import_module('.base', 'django.db.backends.%s' % backend_name)
-        import warnings
-        warnings.warn(
-            "Short names for DATABASE_ENGINE are deprecated; prepend with 
'django.db.backends.'",
-            PendingDeprecationWarning
-        )
-        return module
+        return import_module('.base', 'django.db.backends.%s' % backend_name)
     except ImportError, e:
         # Look for a fully qualified database backend name
         try:

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.


Reply via email to