#8681: Uncaught exception in django/db/models/base.py: UnboundLocalError
--------------------------------------+-------------------------------------
Reporter: HM <[EMAIL PROTECTED]> | Owner: nobody
Status: new | Milestone:
Component: Core framework | Version: SVN
Keywords: models, onetoonefield | Stage: Unreviewed
Has_patch: 0 |
--------------------------------------+-------------------------------------
In source:django/trunk/django/db/models/base.py as of [8696], lines
197-203:
{{{
#!python
for field in fields_iter:
rel_obj = None
if kwargs:
if isinstance(field.rel, ManyToOneRel):
try:
# Assume object instance was passed in.
rel_obj = kwargs.pop(field.name)
}}}
If kwargs[field.name] is None, rel_obj is set to None, val is not set at
all, and we get an UnboundLocalError at line 226. Context: the model in
question had a OneToOneField whose primary_key was not yet set/was set to
None and a save() was attempted.
See stacktrace at dpaste: http://dpaste.com/74655/
Either we need to have a better error-message here, for instance
mentioning what field is the problem and how it can be fixed, or the code
needs to do something sensible.
--
Ticket URL: <http://code.djangoproject.com/ticket/8681>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---