Pyramid's approach to decorators is that you may use the decorator=
argument. The xmlrpc_method forwards arguments to config.add_view so
everything that works with normal pyramid views will work with your methods.

def my_decorator(wrapped):
    def wrapper(context, request):
        # do stuff
        response = wrapped(context, request)
        return response
    return wrapper

@xmlrpc_method(..., decorator=my_decorator)

In this way you can easily write decorators that only accept context,
request without having to worry about the signature / args of your callable.

On Fri, Apr 1, 2016 at 6:08 AM, Petr Blahos <petrbla...@gmail.com> wrote:

> Hi,
>
> I am using pyramid_rpc to define an xmlrpc api methods like this:
>
> @xmlrpc_method(endpoint='napi')
> def getiteminfo(request, wp, userid, item_type, pn):
>     " the actual function "
>
>
> and I would like to wrap the methods with another decorator,
> in this case for measuring and debugging purposes. Is it possible?
>
> Thanks,
> Petr
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pylons-discuss+unsubscr...@googlegroups.com.
> To post to this group, send email to pylons-discuss@googlegroups.com.
> Visit this group at https://groups.google.com/group/pylons-discuss.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
Visit this group at https://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to