Do you think I can alter the type of the returned objects into lists
by doing some magic __metaclass__ = ListType stuff? It would work then!
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