HI,

Seems reasonable to me. Can you submit a ticket on this?

Thanks,
Kevin

On Aug 2, 2006, at 7:06 AM, Arnar Birgisson wrote:

>
> Hi there,
>
> Following is code for json.py that seems to handle sqlalchemy classes
> automatically (plain SA, guess it should also work on ActiveMapper
> classes).
>
> Could someone who knows SA better that me take a look and tell me if
> they think I'm doing it wrong?
>
> Arnar
>
>
> from turbojson.jsonify import jsonify
>
> import sqlalchemy
>
> @jsonify.when("isinstance(obj,  
> sqlalchemy.attributes.InstrumentedList)")
> def jsonify_salist(obj):
>     return list(obj)
>
> @jsonify.when("hasattr(obj, 'c') and isinstance(obj.c,
> sqlalchemy.util.OrderedProperties)")
> def jsonify_saobject(obj):
>     props = {}
>     for key in obj.c.keys():
>         props[key] = getattr(obj, key)
>     return props
>
> >


--
Kevin Dangoor
TurboGears / Zesty News

email: [EMAIL PROTECTED]
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to