|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
SqlAlchemy AdapterHi Dave,
I had to make slight changes to your version of SQLAlchemy adapter to return the correct results for my project. The patch is: ----------->8------------- _sqlalchemy.patch -------------- >8--------------- --- /home/papagr/_sqlalchemy_old.py 2008-09-18 17:29:06.000000000 +0200 +++ /home/papagr/_sqlalchemy_new.py 2008-09-18 17:29:20.000000000 +0200 @@ -17,14 +17,15 @@ return pyamf.util.native_get_attrs(obj) attrs = {} - for property in obj.__dict__: - if property in sa_properties: + mapper = obj._sa_class_manager.mapper + for property in mapper.iterate_properties: + if property.key in sa_properties: continue - if property.startswith('__'): + if property.key.startswith('__'): continue - attrs[property] = getattr(obj, property) + attrs[property.key] = getattr(obj, property.key) return attrs def write_SA_collection(obj): ----------->8------------- _sqlalchemy.patch -------------- >8--------------- The reason for using object's mapper to iterate properties instead of fetching object's __dict__ is because SQLAlchemy initially creates _CompileOnAttr except if you manually call mapper's compile method. Expecting your comments, Cheers, Nikos. _______________________________________________ PyAMF dev mailing list - dev@... http://lists.pyamf.org/mailman/listinfo/dev |
|
|
Re: SqlAlchemy AdapterThanks guys.
Could one of you add this patch to the ticket #277 so mvtellingen can check it out? Cheers, Thijs On 18 sep 2008, at 18:04, nikos@... wrote:
_______________________________________________ PyAMF dev mailing list - dev@... http://lists.pyamf.org/mailman/listinfo/dev |
|
|
Re: SqlAlchemy AdapterOn Sep 18, 2008, at 6:08 PM, Thijs Triemstra|Collab wrote:
It is done. You can find the patch in: http://pyamf.org/attachment/ticket/277/pyamf-new-sqlalchemy-adapter.patch _______________________________________________ PyAMF dev mailing list - dev@... http://lists.pyamf.org/mailman/listinfo/dev |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |