Author: Alex
Date: 2009-11-23 10:44:05 -0600 (Mon, 23 Nov 2009)
New Revision: 11770

Modified:
   django/branches/soc2009/multidb/TODO
   django/branches/soc2009/multidb/django/db/models/base.py
   django/branches/soc2009/multidb/django/db/models/options.py
   django/branches/soc2009/multidb/django/db/models/query.py
   django/branches/soc2009/multidb/docs/ref/models/options.txt
Log:
[soc2009/multidb] Removed _meta.using. This shouldn't be a model-level 
property.  Patch from Russell Keith-Magee.

Modified: django/branches/soc2009/multidb/TODO
===================================================================
--- django/branches/soc2009/multidb/TODO        2009-11-23 16:43:54 UTC (rev 
11769)
+++ django/branches/soc2009/multidb/TODO        2009-11-23 16:44:05 UTC (rev 
11770)
@@ -10,7 +10,6 @@
  * Resolve the public facing UI issues around using multi-db
    * Should we take the opportunity to modify DB backends to use fully 
qualified paths?
    * Should we clean up DATABASES['DATABASE_NAME'] to DATABASES['NAME'] etc?
-   * Meta.using? Is is still required/desirable?
  * Cleanup of new API entry points
     * validate() on a field
         * name/purpose clash with Honza?

Modified: django/branches/soc2009/multidb/django/db/models/base.py
===================================================================
--- django/branches/soc2009/multidb/django/db/models/base.py    2009-11-23 
16:43:54 UTC (rev 11769)
+++ django/branches/soc2009/multidb/django/db/models/base.py    2009-11-23 
16:44:05 UTC (rev 11770)
@@ -438,7 +438,7 @@
         need for overrides of save() to pass around internal-only parameters
         ('raw', 'cls', and 'origin').
         """
-        using = using or self._state.db or self._meta.using or DEFAULT_DB_ALIAS
+        using = using or self._state.db or DEFAULT_DB_ALIAS
         connection = connections[using]
         assert not (force_insert and force_update)
         if cls is None:
@@ -591,7 +591,7 @@
             parent_obj._collect_sub_objects(seen_objs)
 
     def delete(self, using=None):
-        using = using or self._state.db or self._meta.using or DEFAULT_DB_ALIAS
+        using = using or self._state.db or DEFAULT_DB_ALIAS
         connection = connections[using]
         assert self._get_pk_val() is not None, "%s object can't be deleted 
because its %s attribute is set to None." % (self._meta.object_name, 
self._meta.pk.attname)
 

Modified: django/branches/soc2009/multidb/django/db/models/options.py
===================================================================
--- django/branches/soc2009/multidb/django/db/models/options.py 2009-11-23 
16:43:54 UTC (rev 11769)
+++ django/branches/soc2009/multidb/django/db/models/options.py 2009-11-23 
16:44:05 UTC (rev 11770)
@@ -21,7 +21,7 @@
 DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering',
                  'unique_together', 'permissions', 'get_latest_by',
                  'order_with_respect_to', 'app_label', 'db_tablespace',
-                 'abstract', 'managed', 'proxy', 'using', 'auto_created')
+                 'abstract', 'managed', 'proxy', 'auto_created')
 
 class Options(object):
     def __init__(self, meta, app_label=None):
@@ -47,7 +47,6 @@
         self.proxy_for_model = None
         self.parents = SortedDict()
         self.duplicate_targets = {}
-        self.using = None
         self.auto_created = False
 
         # To handle various inheritance situations, we need to track where

Modified: django/branches/soc2009/multidb/django/db/models/query.py
===================================================================
--- django/branches/soc2009/multidb/django/db/models/query.py   2009-11-23 
16:43:54 UTC (rev 11769)
+++ django/branches/soc2009/multidb/django/db/models/query.py   2009-11-23 
16:44:05 UTC (rev 11770)
@@ -25,20 +25,14 @@
     """
     Represents a lazy database lookup for a set of objects.
     """
-    def __init__(self, model=None, query=None):
+    def __init__(self, model=None, query=None, using=None):
         self.model = model
         # EmptyQuerySet instantiates QuerySet with model as None
-        if model:
-            using = model._meta.using
-        else:
-            using = None
-        using = using or DEFAULT_DB_ALIAS
-        connection = connections[using]
+        self.db = using or DEFAULT_DB_ALIAS
         self.query = query or sql.Query(self.model)
         self._result_cache = None
         self._iter = None
         self._sticky_filter = False
-        self.db = using
 
     ########################
     # PYTHON MAGIC METHODS #

Modified: django/branches/soc2009/multidb/docs/ref/models/options.txt
===================================================================
--- django/branches/soc2009/multidb/docs/ref/models/options.txt 2009-11-23 
16:43:54 UTC (rev 11769)
+++ django/branches/soc2009/multidb/docs/ref/models/options.txt 2009-11-23 
16:44:05 UTC (rev 11770)
@@ -4,8 +4,9 @@
 Model ``Meta`` options
 ======================
 
-This document explains all the possible :ref:`metadata options <meta-options>` 
 that you can give your model in its internal
-``class Meta``.
+This document explains all the possible :ref:`metadata options
+<meta-options>` that you can give your model in its internal ``class
+Meta``.
 
 Available ``Meta`` options
 ==========================
@@ -220,17 +221,6 @@
 
     unique_together = ("driver", "restaurant")
 
-``using``
----------
-
-.. attribute:: Options.using
-
-The alias for the default database to be used for this model.  If this is not
-provided the default is ``'default'``.  If it is porvided it can be overidden
-at the ``QuerySet`` level with the ``using()`` method.
-
-.. versionadded:: 1.2
-
 ``verbose_name``
 ----------------
 

--

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


Reply via email to