#12685: Serialized objects' save function does not respect force_insert
---------------------------------------------------+------------------------
Reporter: dcotruta | Owner: nobody
Status: reopened | Milestone:
Component: Database layer (models, ORM) | Version: 1.1
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Changes (by dcotruta):
* has_patch: 0 => 1
* needs_tests: 0 => 1
Comment:
The problem is that the call to save_base in core/serializers/base.py
within the class DeserializedObject does not have the capability to carry
through the correct signature.
It's simple to fix:
{{{
class DeserializedObject(object):[[BR]]
...
def save(self, save_m2m=True, force_insert=False, force_update=False):
# Call save on the Model baseclass directly. This bypasses any
# model-defined save. The save is also forced to be raw.
# This ensures that the data that is deserialized is literally
# what came from the file, not post-processed by pre_save/save
# methods.
# dcotruta - changed signature to handle force_insert and
force_update
models.Model.save_base(self.object, raw=True,
force_insert=force_insert, force_update=force_update)
...
}}}
I'll provide a patch tonight, when I get round to it.
russellm - next time actually read the problem - I'm not trying to be
rude, but this kind of attitude is not helpful in open source!
--
Ticket URL: <http://code.djangoproject.com/ticket/12685#comment:3>
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.