Ha! objectstore.commit() was where I all did it for!

I will stick to the plan figuring how PyObjC decides what a list is. Then I will someway let it decide the mapper results are also lists.

Thanks for your quick replies!

Koen

On 26-mrt-2006, at 23:02, Michael Bayer wrote:


On Mar 26, 2006, at 3:48 PM, Koen Bok wrote:

Does indeed work, but orders[1].products is still an <instance> object. Is there a way to convert all of the relation results to lists?


not really, since a plain list cannot track changes you have made to that list, and a plain list also does not enforce uniqueness which is also pretty important when eager loading. why is PyObjC expecting plain list() objects and not duck-typed lists ? not very pythonic, maybe you should email them ? other than that, you can work around it in your classes using overridden properties and such, or across the board you can make a monkeypatch to the mapper like this:

        import sqlalchemy.mapping.mapper as mapper

        old_instances = mapper.Mapper.instances

        def instances(*args, **kwargs):
                return list(old_instances(*args, **kwargs))

        mapper.Mapper.instances = instances

however you will lose all ability to use objectstore.commit() with those lists since they arent tracking history.



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to