samwyse <[email protected]> added the comment:
A more general solution would be to pass the RequestHandler instance as
a parameter to the dispatch function. This would allow the function to
pick out more than just the client address. To avoid breaking
pre-existing code, this should be made optional, perhaps by adding a
keyword to the register_function method. Something like this:
def __init__(...):
self._include_request = set()
def register_function(..., include_request=False):
self._include_request.add(method)
Later, the dispatch function would be invoked like this:
kwds = {}
if method in self._include_request:
kwds.update(request=self)
[...]
return self.instance._dispatch(method, params, **kwds)
[...]
return func(client_address, *params, **kwds)
----------
nosy: +samwyse
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue3058>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com