google-code-export / django-pyodbc

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

Django-pyodbc issues with db cache #89

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Setup database caching (http://docs.djangoproject.com/en/dev/topics/cache/)
2. Issue a cache.get() for anything

What is the expected output? What do you see instead?
>>> from django.core.cache import cache
>>> cache.get('')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/django/core/cache/backends/db.py", line 34, in get
    if row[2] < now:
IndexError: list index out of range

The Django cache executes a raw query to fetch data from the cache database. It 
checks if the first row returned is None (cache miss) and then indexes into the 
row. However, because the query to django-pyodbc returns an empty list, it 
passes the is None check and then indexes into an empty list which throws the 
error.

What version of the product are you using? On what operating system?
I'm using Django 1.2.1 with r183 of django-pyodbc with Python2.6.5 on Linux.

Please provide any additional information below.
I believe this is related to issue #79

Original issue reported on code.google.com by djfis...@gmail.com on 20 Sep 2010 at 11:27

GoogleCodeExporter commented 9 years ago
Should wrap cache.get to catch IndexError?

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