You haven't shown me the signature of your decorator or any errors.
Ignoring that, jsonrpc_method, similar to view_config in pyramid,
supports a `decorator` argument that guarantees you a common signature
for decorators:
def common_rpc(view):
def _wrapped(context, request):
# do stuff with request.rpc_args or whatever else
return view(context, request)
return _wrapped
@jsonrpc_method(endpoint="jsonrpc", method="blahblah", decorator=common_rpc)
def blahblah_view(request, .. params):
return {}
On Tue, Aug 7, 2012 at 10:42 AM, Vlad K. <[email protected]> wrote:
>
>
> Hi all,
>
>
> I have a JSON RPC API as a set of methods which all have some common
> processing involved, esp. regarding exceptions. To catch those and in turn
> raise proper JsonRpcError, with proper code and message, I wanted to wrap
> the methods in a common decorator.
>
> @common_rpc
> @jsonrpc_method(endpoint="jsonrpc", method="blahblah")
> def blahblah(request, ...params...):
> ...
>
>
> But then I get "method not found", and if I swap @common_rpc with
> @jsonrpc_method, of course then params are not identified by pyramid_rpc
> (MapplyViewMapper).
>
> Am I doing something wrong, perhaps missing to do something with Venusian?
> Or is it impossible to chain decorators with @jsonrpc_method?
>
>
> Thanks.
>
> --
>
>
> .oO V Oo.
>
>
> Work Hard,
> Increase Production,
> Prevent Accidents,
> and
> Be Happy! ;)
>
> --
> 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.
>
--
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.