#4293: The bug occur in a slice filter. |slice:"1::2" if query set is empty
----------------------------------------+-----------------------------------
Reporter: [EMAIL PROTECTED] | Owner: adrian
Status: closed | Component: Template system
Version: 0.96 | Resolution: invalid
Keywords: loop state | Stage: Accepted
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
----------------------------------------+-----------------------------------
Changes (by Gary Wilson <[EMAIL PROTECTED]>):
* status: new => closed
* resolution: => invalid
Comment:
Well, this is the traceback I get whether the QuerySet is empty or not:
{{{
#!python
Traceback (most recent call last):
File "/home/gdub/bzr/django/main/django/template/__init__.py" in
render_node
741. result = node.render(context)
File "/home/gdub/bzr/django/main/django/template/defaulttags.py" in render
96. values = self.sequence.resolve(context, True)
File "/home/gdub/bzr/django/main/django/template/__init__.py" in resolve
597. obj = func(obj, *arg_vals)
File "/home/gdub/bzr/django/main/django/template/defaultfilters.py" in
slice_
354. return value[slice(*bits)]
File "/home/gdub/bzr/django/main/django/db/models/query.py" in __getitem__
148. return list(self._clone(_offset=offset, _limit=limit))[::k.step]
File "/home/gdub/bzr/django/main/django/db/models/query.py" in __iter__
108. return iter(self._get_data())
File "/home/gdub/bzr/django/main/django/db/models/query.py" in _get_data
470. self._result_cache = list(self.iterator())
File "/home/gdub/bzr/django/main/django/db/models/query.py" in iterator
174. select, sql, params = self._get_sql_clause()
File "/home/gdub/bzr/django/main/django/db/models/query.py" in
_get_sql_clause
550. assert self._offset is None, "'offset' is not allowed without
'limit'"
AssertionError at /lab/items/
'offset' is not allowed without 'limit'
}}}
but now that I think of it, we probably don't want this error to fail
silently since it's an unsupported feature with QuerySets, and is not
really the fault of the filter.
My error doesn't appear to be the same one you are seeing. If you could,
please post more information. The full traceback, the query you are
assigning to `films`, and the generated SQL would be great. Without that,
closing this ticket as invalid as I am unable to reproduce the error you
are seeing.
--
Ticket URL: <http://code.djangoproject.com/ticket/4293#comment:2>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---