Hello list,
I think I've found a potential bug in the the
_django_db_models_base.py adapter handler.
The problem manifests itself when objects coming from flex are
unmarshalled back into python objects and their properties set by the
adapter. I'm using django 1.0.2 and it constrains the order a model
object's attributes can be set:
- The primary key of the object must be set *before* any
relationship fields are set
If relationship fields are set first, but the primary key is null,
django throws an exception. The code for setting the attributes
previously took a dictionary of attributes/values and iteritem-ed over
them, setting all attributes. For normal objects this works perfectly
fine, but for django model objects with relationships, whenever a
relationship field is attempted to be set, the primary key field must
first be set.
I've attached a patch (very simple, like 4 lines of code) to this file
that makes sure the primary key field as set first, before any other
attributes. This solves the above problem and allows for django
object graphs to be sent via pyamf. The patch was created against the
release-0.4.2 svn branch.
Hope this helps, I can also post this as a ticket, but figured I'd
send it out to the mailing list first to make sure it's sane, and see
if anyone else has encountered this issue.
Thanks!
-Mark
_______________________________________________
PyAMF users mailing list -
users@...
http://lists.pyamf.org/mailman/listinfo/users