#11194: Saving proxy model with raw=True gives UnboundLocalError 'record_exists'
---------------------------------------------------+------------------------
Reporter: wardi | Owner: nobody
Status: closed | Milestone: 1.1
Component: Database layer (models, ORM) | Version: 1.1-beta-1
Resolution: fixed | Keywords: proxy
model serialization
Stage: Unreviewed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 1 |
---------------------------------------------------+------------------------
Comment (by sunrise):
OK, so the problem is a combination of using raw=True (as fixture loading
(always?) does) and proxy models. It looks to me like the save_base
routine is coded to never expect to be called with both raw=True and
meta.proxy=True. The attached patch fixes the visible error (avoids an
exception) but the resulting behavior of the function does not appear to
be correct.[http://www.tagnice.com nike air yeezy] It sends a pre-save
signal, then skips out on the saving of parent class(es) because raw is
True, then skips out on the remainder of the try an update, try an insert
logic because meta.proxy is True. The only thing left not under the if not
meta.proxy is the sending of the post save signal. So that patch makes it
possible to call the routine, and the pre and post save signals will be
sent, but nothing will be saved. There seems to be a deeper problem than a
local variable used before being set here.
--
Ticket URL: <http://code.djangoproject.com/ticket/11194#comment:6>
Django <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
-~----------~----~----~----~------~----~------~--~---