stepank/pyws — pull request #28 by spencerogden (2013-01-19 00:43:52+00:00)
Title: Rest routing 2 - Attempt number 2

Hi Stepan,

Not to bombard you with stuff. This branch, rest_routing_2 is I think a much better attempt. It is much less invasive to the codebase. From a user perspective there are two main changes:

1) @register() can register a function under multiple names by taking a list as the first or name parameter.
2) a name passed to @register() can either be a string as before, or a Route(regex,action) object.Route() names are not returns in FunctionManager.get_all so that they do not end up in autogenerated APIs like WSDL.

The Route object acts as a string containing Action_regex for most purposes. This reduces the number of places that need to be altered. But is has the compile regex available.

Behind the scenes there are three main changes:
1) Putting the method in the request, as well as various small changes to adapters, and server to pass around a bit more information for the function manager and protocols to have access to.
2) Change to the FixedFunctionManager.get_one() so that is matches on regex and action if the function name is a Route.
3) Change to REST protocol. Return a Route as the function name. And parse the URI using the functions regex to get parameters.

Let me know what you think, I would be grateful for any feedback.

Spencer