Opened 16 years ago

Last modified 13 years ago

#7464 closed

[QSRF] psycopg2 raises "can't adapt" — at Version 2

Reported by: anonymous Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Keywords: psycopg2, SafeUnicode, qsrf
Cc: digitalxero@… Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

Environment:

Request Method: POST
Request URL: http://www.xeroflow.com/admin/projects/project/add/
Django Version: 0.97-pre-SVN-7661
Python Version: 2.5.1
Installed Applications:
['django.contrib.sites',
 'django.contrib.contenttypes',
 'django.contrib.auth',
 'django.contrib.sessions',
 'django.contrib.humanize',
 'django.contrib.flatpages',
 'django.contrib.admin',
 'django.contrib.sitemaps',
 'apps.attachments',
 'apps.tasks',
 'apps.comments',
 'apps.projects',
 'apps.assetpackager',
 'websites.xeroflow']
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.cache.CacheMiddleware',
 'django.middleware.gzip.GZipMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.doc.XViewMiddleware')

Traceback:

File "/home/andurinc/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response
  82.                 response = callback(request, *callback_args, **callback_kwargs)
File "/home/andurinc/lib/python2.5/site-packages/django/contrib/admin/views/decorators.py" in _checklogin
  62.             return view_func(request, *args, **kwargs)
File "/home/andurinc/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "/home/andurinc/lib/python2.5/site-packages/django/contrib/admin/views/main.py" in add_stage
  264.             new_object = manipulator.save(new_data)
File "/home/andurinc/lib/python2.5/site-packages/django/db/models/manipulators.py" in save
  109.         new_object.save()
File "/home/andurinc/lib/python2.5/site-packages/django/db/abstract_models.py" in save
  33.         super(AbstractCategory, self).save(*args, **kwargs)
File "/home/andurinc/lib/python2.5/site-packages/django/db/models/base.py" in save
  270.         self.save_base()
File "/home/andurinc/lib/python2.5/site-packages/django/db/models/base.py" in save_base
  332.                 result = manager._insert(values, return_id=update_pk)
File "/home/andurinc/lib/python2.5/site-packages/django/db/models/manager.py" in _insert
  118.         return insert_query(self.model, values, **kwargs)
File "/home/andurinc/lib/python2.5/site-packages/django/db/models/query.py" in insert_query
  735.     return query.execute_sql(return_id)
File "/home/andurinc/lib/python2.5/site-packages/django/db/models/sql/subqueries.py" in execute_sql
  300.         cursor = super(InsertQuery, self).execute_sql(None)
File "/home/andurinc/lib/python2.5/site-packages/django/db/models/sql/query.py" in execute_sql
  1474.         cursor.execute(sql, params)
File "/home/andurinc/lib/python2.5/site-packages/django/db/backends/util.py" in execute
  18.             return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /admin/projects/project/add/
Exception Value: can't adapt
params = (u'Second Project', 'second-project', u'This is a second Project', u'2', u'2008-06-16 04:54:56.224657', True, u'Mercurial', u'http://changing.this.url/django/')
sql = 'INSERT INTO "projects_project" ("name", "slug", "description", "manager_id", "started", "public", "repository_type", "repository_url") VALUES (%s, %s, %s, %s, %s, %s, %s, %s)'

It seems the issues of http://code.djangoproject.com/ticket/5996 have returned with the QSRF since when I went in and manually called unicode() on each param it worked fine.

Change History (3)

by Digitalxero@…, 16 years ago

Attachment: base.py.patch added

Patch for the issue

comment:1 by Digitalxero@…, 16 years ago

Has patch: set

Attached a patch for this issue

comment:2 by Ramiro Morales, 16 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top