Menu

Commit [r5154]  Maximize  Restore  History

VcRefactoring/Controller: improve the `RequestProcessor` dispatching logic.

The requests parameters are now automatically associated to arguments of the action methods (`do_<action>` for POSTs, `render_<action>` for GETs and `xhr_<action>` for XMLHttpRequest handler methods).

The complete rules are the following:
0. `req.path_info` is matched using `RequestProcessor.url_pattern` regular expression
1. the handler method's positional arguments are set to either:
1. the value of the similarly named request parameter,
2. the value of the corresponding positional groups from the match
3. to `None`
2. the handler method's keyword arguments are set:
1. the value of the similarly named request parameter,
2. the value of the corresponding named groups from the match
3. to the default value specified in the method signature

This is quite similar to cmlenz's original approach in source:sandbox/controller/trac/web/controller.py, though not exactly the same (there, only keyword arguments could be overriden by request parameters).

cboos 2007-03-30

changed /sandbox/vc-refactoring/trac/versioncontrol/web_ui/browser.py
changed /sandbox/vc-refactoring/trac/versioncontrol/web_ui/changeset.py
changed /sandbox/vc-refactoring/trac/versioncontrol/web_ui/log.py
changed /sandbox/vc-refactoring/trac/web/api.py
/sandbox/vc-refactoring/trac/versioncontrol/web_ui/browser.py Diff Switch to side-by-side view
Loading...
/sandbox/vc-refactoring/trac/versioncontrol/web_ui/changeset.py Diff Switch to side-by-side view
Loading...
/sandbox/vc-refactoring/trac/versioncontrol/web_ui/log.py Diff Switch to side-by-side view
Loading...
/sandbox/vc-refactoring/trac/web/api.py Diff Switch to side-by-side view
Loading...