Permalink
Browse files

allow registering RPC functions with name different than the function…

… name
  • Loading branch information...
1 parent eda2d26 commit 7e8836699f5cc7c140a154946246f4ab2403ad39 Михаил Милушев committed Dec 9, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 rpcenable/registry.py
View
@@ -134,21 +134,22 @@ def __init__ (self, logging, allow_none, encoding):
self.reg[''].register_introspection_functions()
self.logging = logging
- def _add_function (self, function, prefix):
+ def _add_function (self, function, prefix, name=None):
r = self.reg.get(prefix)
if not r:
# create the prefix on the fly
self.reg[prefix] = CustomCGIXMLRPCRequestHandler(allow_none=self.allow_none, encoding=self.encoding)
self.reg[prefix].register_introspection_functions()
# register the decorated function, and return it with no changes
- self.reg[prefix].register_function (function)
+ self.reg[prefix].register_function(function, name)
def register_rpc (self, *exargs, **exkw):
"""
Decorator with optional arguments, that register a function as an RPC call
"""
- prefix = exkw.get('prefix','')
+ prefix = exkw.get('prefix', '')
+ name = exkw.get('name', None)
def outer (f):
self._add_function (f, prefix, name=name)

0 comments on commit 7e88366

Please sign in to comment.