Reference¶
urldispatcher
- class webdispatch.urldispatcher.URLDispatcher(applications=None, extra_environ=None, **kwargs)¶
dispatch applications with url patterns.
- add_subroute(pattern)¶
create new URLDispatcher routed by pattern
- add_url(name, pattern, application)¶
add url pattern dispatching to application
- detect_view_name(environ)¶
detect view name from environ
- on_view_not_found(environ, start_response)¶
called when views not found
- class webdispatch.urldispatcher.URLGenerator(environ, urlmapper)¶
generate url form parameters and url patterns.
- generate(name, **kwargs)¶
generate full qualified url for named url pattern with kwargs
- make_full_qualified_url(path)¶
append application url to path
- class webdispatch.urldispatcher.URLMapper(converters=None)¶
find application matched url pattern.
- add(name, pattern)¶
add url pattern for name
- generate(name, **kwargs)¶
generate url for named url pattern with kwargs
- lookup(path_info)¶
lookup url match for path_info
methoddispatcher
- class webdispatch.methoddispatcher.ActionDispatcher(action_var_name='action')¶
wsgi application dispatching actions to registered classes
- detect_view_name(environ)¶
get view name from routing args
- on_view_not_found(environ, start_response)¶
called when action is not found
- register_actionhandler(action_handler)¶
register class as action handler
- class webdispatch.methoddispatcher.MethodDispatcher(**kwargs)¶
dispatch applications with request method.
- detect_view_name(environ)¶
convert request method to view name
- on_view_not_found(_, start_response)¶
called when valid view is not found
- webdispatch.methoddispatcher.action_handler_adapter(handler_cls, action_name)¶
wraps class to wsgi application dispathing action
useful mixin classes
- class webdispatch.mixins.URLMapperMixin¶
mixin to add generate_url() method.
- generate_url(name, **kwargs)¶
generate url with urlgenerator used by urldispatch
- urlmapper¶
get urlmapper object from wsgi environ