mosquito / aiohttp-xmlrpc

XMLRPC for aiohttp
MIT License
34 stars 19 forks source link

Allow custom method names other than the default on server side #49

Closed ArmandBENETEAU closed 2 years ago

ArmandBENETEAU commented 2 years ago

This new feature is useful for a user that wants to use dot ('.') in the xmlrpc method names available in its server. Indeed, this is not possible in python function definition.

Therefore, this feature can be used to "simulate" nested methods.

The implementation of this feature does not use true nested methods (i.e. methods in sub-classes of the main class, inheriting from handler.XMLRPCView).

Instead, it simply allows the user to overwrite some method names thanks to a METHOD_NAMES dictionary attribute in the user class (the one inheriting from handler.XMLRPCView). The default behavior is kept. So, this code is compatible with projects using an older version of aiohttp-xmlrpc.

This approach has been used in order to not modify the whole code structure of the 'handler.py' and still offer 'nested' methods from the client point of view.

The README.rst file and the tests have been updated and completed accordingly.

Signed-off-by: Armand Bénéteau armand.beneteau@iot.bzh

mosquito commented 2 years ago

released in 1.5.0

mosquito commented 2 years ago

@ArmandBENETEAU Excellent work by the way. Thank you.

ArmandBENETEAU commented 2 years ago

It was a pleasure @mosquito ! Thank you too.