Author: Alex
Date: 2010-07-19 16:04:03 -0500 (Mon, 19 Jul 2010)
New Revision: 13438

Modified:
   django/branches/soc2010/query-refactor/django/contrib/mongodb/compiler.py
   django/branches/soc2010/query-refactor/tests/regressiontests/mongodb/tests.py
Log:
[soc2010/query-refactor] Provide a more useful error message on disjunctions.

Modified: 
django/branches/soc2010/query-refactor/django/contrib/mongodb/compiler.py
===================================================================
--- django/branches/soc2010/query-refactor/django/contrib/mongodb/compiler.py   
2010-07-19 20:36:07 UTC (rev 13437)
+++ django/branches/soc2010/query-refactor/django/contrib/mongodb/compiler.py   
2010-07-19 21:04:03 UTC (rev 13438)
@@ -25,6 +25,9 @@
         self.using = using
     
     def get_filters(self, where):
+        if where.connector != "AND":
+            raise UnsupportedDatabaseOperation("MongoDB only supports joining "
+                "filters with and, not or.")
         assert where.connector == "AND"
         filters = {}
         for child in where.children:

Modified: 
django/branches/soc2010/query-refactor/tests/regressiontests/mongodb/tests.py
===================================================================
--- 
django/branches/soc2010/query-refactor/tests/regressiontests/mongodb/tests.py   
    2010-07-19 20:36:07 UTC (rev 13437)
+++ 
django/branches/soc2010/query-refactor/tests/regressiontests/mongodb/tests.py   
    2010-07-19 21:04:03 UTC (rev 13438)
@@ -1,5 +1,5 @@
 from django.db import connection, UnsupportedDatabaseOperation
-from django.db.models import Count, Sum, F
+from django.db.models import Count, Sum, F, Q
 from django.test import TestCase
 
 from models import Artist, Group
@@ -392,3 +392,7 @@
         self.assert_unsupported(
             lambda: Artist.objects.aggregate(Count("id"), Count("pk"))
         )
+        
+        self.assert_unsupported(
+            Artist.objects.filter(Q(pk=0) | Q(pk=1))
+        )

-- 
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=en.

Reply via email to