Mercurial > hg > webob_view
changeset 2:4ebaf68f2272
moving to dispatcher as that's what it is now
author | k0s <k0scist@gmail.com> |
---|---|
date | Thu, 29 Oct 2009 15:11:05 -0400 |
parents | eb2cb7ebc849 |
children | 4dcb932065e4 |
files | webob_view/template/+package+/+package+.py_tmpl webob_view/template/+package+/dispatcher.py |
diffstat | 2 files changed, 26 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/webob_view/template/+package+/+package+.py_tmpl Thu Oct 29 15:08:54 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -""" -${repr(project)}: a view with webob -""" - -from handlers import Get, Post -from webob import Request, exc - -class Dispatcher(object): - - ### class level variables - defaults = {} - - def __init__(self, **kw): - for key in self.defaults: - setattr(self, key, kw.get(key, self.defaults[key])) - self.handlers = [ Get, Post ] - - ### methods dealing with HTTP - def __call__(self, environ, start_response): - request = Request(environ) - for h in self.handlers: - if h.match(request): - handler = h(request) - break - res = handler() - return res(environ, start_response)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webob_view/template/+package+/dispatcher.py Thu Oct 29 15:11:05 2009 -0400 @@ -0,0 +1,26 @@ +""" +request dispatcher +""" + +from handlers import Get, Post +from webob import Request, exc + +class Dispatcher(object): + + ### class level variables + defaults = {} + + def __init__(self, **kw): + for key in self.defaults: + setattr(self, key, kw.get(key, self.defaults[key])) + self.handlers = [ Get, Post ] + + ### methods dealing with HTTP + def __call__(self, environ, start_response): + request = Request(environ) + for h in self.handlers: + if h.match(request): + handler = h(request) + break + res = handler() + return res(environ, start_response)