Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#10468 closed (invalid)

django/db/models/sql/ fails on tuple unpacking

Reported by: anonymous Owned by: nobody
Component: Core (Other) Version: 1.0
Severity: Keywords: db sql
Cc: django-admin --version: 1.0.2 final Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by Alex Gaynor)

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/ 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.



Request Method: GET
Request URL: http://localhost:8000/text/5/
Django Version: 1.0.2 final
Python Version: 2.5.2
Installed Applications:
Installed Middleware:

File "/var/lib/python-support/python2.5/django/core/handlers/" in get_response
  86.                 response = callback(request, *callback_args, **callback_kwargs)
File "/media/Daten/Projects/Webproj/evankproj/../evankproj/textapp/" in view_text
  8.     text = get_object_or_404(Text, text_id)
File "/var/lib/python-support/python2.5/django/shortcuts/" in get_object_or_404
  46.         return queryset.get(*args, **kwargs)
File "/var/lib/python-support/python2.5/django/db/models/" in get
  303.         clone = self.filter(*args, **kwargs)
File "/var/lib/python-support/python2.5/django/db/models/" in filter
  489.         return self._filter_or_exclude(False, *args, **kwargs)
File "/var/lib/python-support/python2.5/django/db/models/" in _filter_or_exclude
  507.             clone.query.add_q(Q(*args, **kwargs))
File "/var/lib/python-support/python2.5/django/db/models/sql/" in add_q
  1258.                             can_reuse=used_aliases)
File "/var/lib/python-support/python2.5/django/db/models/sql/" 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).

Change History (3)

comment:1 Changed 8 years ago by Alex Gaynor

Description: modified (diff)
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Please use the preview button.

comment:2 Changed 8 years ago by Alex Gaynor

Resolution: invalid
Status: newclosed

In this example what is text_id? It looks to me that what you meant to do is get_object_or_404(Text, id=text_id) and thus I'm marking as invalid.

comment:3 Changed 8 years ago by anonymous

Yes, meant that. Just didn't see it. But, well, the Traceback looks very confusing and deeply in the hierarchie. Maybe improvable?

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