1
0
mirror of https://github.com/django/django.git synced 2025-07-06 10:49:17 +00:00

queryset-refactor: Moved _merge_sanity_check into a more logical place in the

code.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7395 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-04-01 00:25:32 +00:00
parent 570c12aeb8
commit 70913a2c43

View File

@ -118,14 +118,6 @@ class _QuerySet(object):
except self.model.DoesNotExist, e:
raise IndexError, e.args
def _merge_sanity_check(self, other):
"""
Checks that we are merging two comparable queryset classes.
"""
if self.__class__ is not other.__class__:
raise TypeError("Cannot merge querysets of different types ('%s' and '%s'."
% (self.__class__.__name__, other.__class__.__name__))
def __and__(self, other):
self._merge_sanity_check(other)
combined = self._clone()
@ -470,6 +462,14 @@ class _QuerySet(object):
except StopIteration:
self._iter = None
def _merge_sanity_check(self, other):
"""
Checks that we are merging two comparable queryset classes.
"""
if self.__class__ is not other.__class__:
raise TypeError("Cannot merge querysets of different types ('%s' and '%s'."
% (self.__class__.__name__, other.__class__.__name__))
# Use the backend's QuerySet class if it defines one. Otherwise, use _QuerySet.
if connection.features.uses_custom_queryset:
QuerySet = connection.ops.query_set_class(_QuerySet)