WilliamRen / django-pyodbc

Automatically exported from code.google.com/p/django-pyodbc
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

admin access failure (TypeError: 'NoneType' object is unsubscriptable) #79

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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

Original issue reported on code.google.com by djfis...@gmail.com on 29 Apr 2010 at 12:46

GoogleCodeExporter commented 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

GoogleCodeExporter commented 8 years ago
a workaround in r178.

Original comment by vcc.ch...@gmail.com on 30 Apr 2010 at 4:50

GoogleCodeExporter commented 8 years ago
Some more info here

http://code.djangoproject.com/ticket/12634

Original comment by claudiom...@gmail.com on 30 Apr 2010 at 12:09

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago

Original comment by vcc.ch...@gmail.com on 24 Mar 2011 at 4:57