On Mon, Jan 3, 2011 at 10:47 AM, Chris McDonough <chr...@plope.com> wrote:
> On Mon, 2011-01-03 at 08:49 +0100, Eric Lemoine wrote:
>> On Mon, Jan 3, 2011 at 8:23 AM, Chris McDonough <chr...@plope.com> wrote:
>> > On Mon, 2011-01-03 at 08:15 +0100, Eric Lemoine wrote:
>> >> Hi
>> >>
>> >> When using the json renderer I'd like to be able to pass args (cls) to
>> >> json.dumps. From my understanding of the Pyramid code this isn't
>> >> currently possible. Would extending the json_renderer_factory for that
>> >> make sense? Or is implementing a specific json renderer factory so
>> >> trivial that a patch to json_renderer_factory doesn't make sense.
>> >
>> > If it's truly trivial, and mostly backwards compatible, and makes more
>> > sense as a default than what the current json renderer does, we could
>> > add it to the default renderer.
>> >
>> >>  If a
>> >> patch to json_renderer_factory does make sense I'm happy to provide
>> >> one; for that, guidelines on how/where the dumps args would be
>> >> provided would be helpful.
>> >
>> > The dump args are dynamic?  What would provide them?
>>
>> I was thinking about something on a per-view basis. So
>> view_config/add_view would provide them.
>
> Could you provide a "science fiction" example of what something like
> that might look like?


@view_config(renderer='json', render_args=dict(cls=MyJSONEncoder))
def my_view(request):
    return {'content':'Hello!'}

render_args would include renderer-specific args.

This is just an example that would work for my use case, but things
may look differently.

Thanks,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemo...@camptocamp.com
http://www.camptocamp.com

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-de...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to