Ticket #2351: diff_fix_queryset_getitem.txt

File diff_fix_queryset_getitem.txt, 756 bytes (added by marcin@…, 17 years ago)
Line 
1Index: C:/checkout/ldev_glamisu/django/django/db/models/query.py
2===================================================================
3--- C:/checkout/ldev_glamisu/django/django/db/models/query.py (revision 4537)
4+++ C:/checkout/ldev_glamisu/django/django/db/models/query.py (working copy)
5@@ -111,6 +111,8 @@
6 assert (not isinstance(k, slice) and (k >= 0)) \
7 or (isinstance(k, slice) and (k.start is None or k.start >= 0) and (k.stop is None or k.stop >= 0)), \
8 "Negative indexing is not supported."
9+ if not isinstance(k, (slice, int)):
10+ raise TypeError, "Specify an integer index or a slice"
11 if self._result_cache is None:
12 if isinstance(k, slice):
13 # Offset:
Back to Top