Opened 11 years ago

Closed 11 years ago

#3618 closed (fixed)

Test fixtures break postgresql_psycopg2 backend

Reported by: Alex Dedul Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: master
Severity: Keywords: psycopg2
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I get the following error:

Traceback (most recent call last):

  File "/usr/local/lib/python2.5/site-packages/django/core/handlers/", line 68, in get_response
    callback, callback_args, callback_kwargs = resolver.resolve(request.path)

  File "/usr/local/lib/python2.5/site-packages/django/core/", line 162, in resolve
    sub_match = pattern.resolve(new_path)

  File "/usr/local/lib/python2.5/site-packages/django/core/", line 162, in resolve
    sub_match = pattern.resolve(new_path)

  File "/usr/local/lib/python2.5/site-packages/django/core/", line 118, in resolve
    return self.callback, args, kwargs

  File "/usr/local/lib/python2.5/site-packages/django/core/", line 129, in _get_callback
    raise ViewDoesNotExist, "Tried %s in module %s. Error was: %s" % (func_name, mod_name, str(e))

ViewDoesNotExist: Tried list in module intranet.orders.views.vpn_review. Error was: 'psycopg2._psycopg.cursor' object has no attribute 'dictfetchone'

It started to work for me with this simple patch

Index: django/db/backends/postgresql_psycopg2/
--- django/db/backends/postgresql_psycopg2/  (revision 4659)
+++ django/db/backends/postgresql_psycopg2/  (working copy)
@@ -54,7 +54,7 @@
         global postgres_version
         if not postgres_version:
             cursor.execute("SELECT version()")
-            postgres_version = [int(val) for val in cursor.dictfetchone()['version'].split()[1].split('.')]        
+            postgres_version = [int(val) for val in dictfetchone(cursor)['version'].split()[1].split('.')]        
         if settings.DEBUG:
             return util.CursorDebugWrapper(cursor, self)
         return cursor

Change History (1)

comment:1 Changed 11 years ago by Alex Dedul

Resolution: fixed
Status: newclosed

Already fixed in [4660].

Note: See TracTickets for help on using tickets.
Back to Top