On 08/07/2012 06:56 PM, Michael Merickel wrote:
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:


Ah, I missed to check the docs on config.add_view(). Yeah, the decorator argument now does what I expect of the code.

The error was simple, default pyramid_jsonrpc "method not found" which you get if you call an unregistered method, and the common_rpc() decorator is the following:

   def common_rpc(f):
        def wrapped_rpc(*args, **kwargs):
            try:
                return f(*args, **kwargs)
            except c.Invalid as e:
                fields = e.asdict()
                #log.debug(u"Invalid params: " + unicode(fields))
                raise JsonRpcParamsInvalid(data=fields)
            except PermissionError as e:
                raise JsonRpcError(code=e.code, message=e.message)
            except NotFoundError as e:
                raise JsonRpcError(code=E_NOT_FOUND)

        return wrapped_rpc


Many 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.

Reply via email to