May be you can try to look into the just add such a line to the base, it
can help you get the list of defined properties of the model,
class Base(object):
def __init__(self, *args, **kwargs):
# do your business here
self._to_serialize=self.__table__.columns.keys()
# do some other thing or add other stuff you want to serialize
But it can only return those explicitly defined columns, properties won't
be returned, you can add them later.
Regards,
Cosmia
On Thursday, March 1, 2012 11:04:50 PM UTC+8, Alexis Metaireau wrote:
>
> What I'm doing is to add a property on the models I want to serialize,
> and to use a custom json serializer for this purpose.
>
> Have a look at
>
> https://github.com/spiral-project/ihatemoney/blob/master/budget/models.py#L12
> and
> https://github.com/ametaireau/flask-rest/blob/master/flask_rest.py#L144
>
> However, this isn't automatic, and it is probably possible to automate
> this without having to explicitly specify what you want to serialize
> (like Julien did)
>
>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/pylons-discuss/-/Zbb1Bj8dMLcJ.
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/pylons-discuss?hl=en.