﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
10468	django/db/models/sql/query.py fails on tuple unpacking	anonymous	nobody	"Got the following error:

ValueError at /text/5/

need more than 1 value to unpack
{{{
Request Method: 	GET
Request URL: 	http://localhost:8000/text/5/
Exception Type: 	ValueError
Exception Value: 	
}}}
need more than 1 value to unpack
{{{
Exception Location: 	/var/lib/python-support/python2.5/django/db/models/sql/query.py in add_filter, line 1101
Python Executable: 	/usr/bin/python
Python Version: 	2.5.2
Python Path: 	['/media/Daten/Projects/Webproj/evankproj', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/Numeric', '/usr/lib/python2.5/site-packages/PIL', '/usr/lib/python2.5/site-packages/gst-0.10', '/var/lib/python-support/python2.5', '/usr/lib/python2.5/site-packages/gtk-2.0', '/var/lib/python-support/python2.5/gtk-2.0', '/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode']

With a Model

  6 class Text(models.Model):
  7     text = models.CharField(max_length=(10 ** 5))
  8     date = models.DateTimeField()

With a view

  7 def view_text(request, text_id):
  8     text = get_object_or_404(Text, text_id)
  9     return render_to_response(u""text.html"", {u""text"": text})

The Following is the output of the development server:

[11/Mar/2009 16:30:39] ""GET /text/5 HTTP/1.1"" 301 0
[11/Mar/2009 16:30:39] ""GET /text/5/ HTTP/1.1"" 500 71938

text/5/ works as in the Django Tutorial with polls/\d+ for a poll_id.

Traceback:

Environment:

Request Method: GET
Request URL: http://localhost:8000/text/5/
Django Version: 1.0.2 final
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'evankproj.textapp']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File ""/var/lib/python-support/python2.5/django/core/handlers/base.py"" in get_response
  86.                 response = callback(request, *callback_args, **callback_kwargs)
File ""/media/Daten/Projects/Webproj/evankproj/../evankproj/textapp/views.py"" in view_text
  8.     text = get_object_or_404(Text, text_id)
File ""/var/lib/python-support/python2.5/django/shortcuts/__init__.py"" in get_object_or_404
  46.         return queryset.get(*args, **kwargs)
File ""/var/lib/python-support/python2.5/django/db/models/query.py"" in get
  303.         clone = self.filter(*args, **kwargs)
File ""/var/lib/python-support/python2.5/django/db/models/query.py"" in filter
  489.         return self._filter_or_exclude(False, *args, **kwargs)
File ""/var/lib/python-support/python2.5/django/db/models/query.py"" in _filter_or_exclude
  507.             clone.query.add_q(Q(*args, **kwargs))
File ""/var/lib/python-support/python2.5/django/db/models/sql/query.py"" in add_q
  1258.                             can_reuse=used_aliases)
File ""/var/lib/python-support/python2.5/django/db/models/sql/query.py"" in add_filter
  1101.         arg, value = filter_expr

Exception Type: ValueError at /text/5/
Exception Value: need more than 1 value to unpack
}}}

I didn't find anything relevant in the tickets on a search for the traceback message (tuple unpacking failing)."		closed	Core (Other)	1.0		invalid	db sql query.py	django-admin --version: 1.0.2 final	Unreviewed	0	0	0	0	0	0
