I ended up moving the issue out of the jsonified method, as Domhnall
suggested, which is working nicely and may have some extra benefits.

Needless to say I'll be looking closely at jsonify as we move closer
to 1.0.

Many thanks to all.


On May 2, 9:10 am, Philip Jenvey <[email protected]> wrote:
> On May 1, 2009, at 12:45 AM, Marius Gedminas wrote:
>
>
>
> > It's tricky, but not too tricky, if you only accept keyword  
> > arguments in
> > to @jsonify():
>
> Yep, but I definitely don't want to keep it working both ways going  
> forward (1.0). It'd be a good stopgap.
>
>
>
> >    def jsonify(fn=None, arg1=value1, arg2=value2):
> >        if fn is None:
> >            # this is @jsonify(arg1=...), so return a decorator
> >            return functools.partial(jsonify, arg1=arg1, arg2=arg2)
> >       �[email protected]
> >        def wrapped(*a, **kw):
> >            # do stuff
> >            retval = fn(*a, **kw)
> >            return simplejson.dumps(retval, arg1=arg1, arg2=arg2)
> >        return wrapped
>
> functools.wraps here isn't enough because it doesn't maintain the  
> method argspec -- we need the decorator module magic. Pylons needs the  
> argspec maintained to know what routing args to pass along.
>
> --
> Philip Jenvey
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to