Closed GoogleCodeExporter closed 8 years ago
Here's the most concise way to reproduce the bug from the Django shell (python
manage.py runserver):
>>> from django.contrib.sessions.models import Session
>>> slist = Session.objects.filter(session_key='123123123')
>>> slist.exists()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 494, in exists
return self.query.has_results(using=self.db)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 411, in has_results
return bool(compiler.execute_sql(SINGLE))
File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql
return cursor.fetchone()[:-len(self.query.ordering_aliases)]
TypeError: 'NoneType' object is unsubscriptable
It only causes a problem when you search for an item that does not exist. What
it looks like is that django-pyodbc is setting the query objects
ordering_aliases (compiler.py). None of the Django supported backends do this.
Original comment by djfis...@gmail.com
on 29 Apr 2010 at 10:32
a workaround in r178.
Original comment by vcc.ch...@gmail.com
on 30 Apr 2010 at 4:50
Some more info here
http://code.djangoproject.com/ticket/12634
Original comment by claudiom...@gmail.com
on 30 Apr 2010 at 12:09
Thanks for the response. I have reverted all of my custom code and I am now
running on
a clean trunk checkout of django-pyodbc and so far everything appears to be
running
smoothly. I'll let you know if I run into any issues.
Still, while the workaround seems to work (I'd come up with more or less the
same
workaround), I'm not sure it should be the final answer. I think some of the
ordering
code should be cleaned out to be more in line with the other backends.
Original comment by djfis...@gmail.com
on 30 Apr 2010 at 8:58
Original comment by vcc.ch...@gmail.com
on 24 Mar 2011 at 4:57
Original issue reported on code.google.com by
djfis...@gmail.com
on 29 Apr 2010 at 12:46