comparison dogdish/dispatcher.py @ 8:ebb65758d725

add a default directory
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 16 Oct 2012 16:34:22 -0700
parents 65d0a1153864
children f517d80bafe0
comparison
equal deleted inserted replaced
7:65d0a1153864 8:ebb65758d725
3 """ 3 """
4 dogdish 4 dogdish
5 https://bugzilla.mozilla.org/show_bug.cgi?id=800118 5 https://bugzilla.mozilla.org/show_bug.cgi?id=800118
6 """ 6 """
7 7
8 import os
8 import sys 9 import sys
9 from urlparse import urlparse 10 from urlparse import urlparse
10 from webob import Request 11 from webob import Request
11 from webob import Response, exc 12 from webob import Response, exc
13
14 here = os.path.dirname(os.path.abspath(__file__))
12 15
13 class Handler(object): 16 class Handler(object):
14 17
15 def __init__(self, request): 18 def __init__(self, request):
16 self.request = request 19 self.request = request
60 body=body % query) 63 body=body % query)
61 64
62 class Dispatcher(object): 65 class Dispatcher(object):
63 66
64 ### class level variables 67 ### class level variables
65 defaults = {} 68 defaults = {'directory': here}
66 69
67 def __init__(self, **kw): 70 def __init__(self, **kw):
68 for key in self.defaults: 71 for key in self.defaults:
69 setattr(self, key, kw.get(key, self.defaults[key])) 72 setattr(self, key, kw.get(key, self.defaults[key]))
70 self.handlers = [ Get ] 73 self.handlers = [ Get ]