My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 79: admin access failure (TypeError: 'NoneType' object is unsubscriptable)
1 person starred this issue and may be notified of changes. Back to list
Status:  Verified
Owner:  ----
Closed:  Mar 2011


Sign in to add a comment
 
Reported by djfis...@gmail.com, Apr 28, 2010
What steps will reproduce the problem?
1. Setup django-pyodbc against Django 1.2
2. Add the admin application on your default database with django-pyodbc
3. Connect to the admin

What is the expected output? What do you see instead?
The admin should load but instead I see the error:
TypeError: 'NoneType' object is unsubscriptable

The full traceback is in the the Django ticket below...

What version of the product are you using? On what operating system?
r177 (patched with the patches from #73 and #76)

Please provide any additional information below.
See the Django ticket: http://code.djangoproject.com/ticket/12634


Apr 29, 2010
#1 djfis...@gmail.com
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. 
Apr 29, 2010
Project Member #2 vcc.ch...@gmail.com
a workaround in r178.
Apr 30, 2010
#4 djfis...@gmail.com
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.
Mar 23, 2011
Project Member #5 vcc.ch...@gmail.com
(No comment was entered for this change.)
Status: Verified
Sign in to add a comment

Powered by Google Project Hosting