comparison wordstream/dispatcher.py @ 6:ffe01043ecea

* allow jquery location to become configurable
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 21 Dec 2010 18:07:15 -0800
parents e21f53582267
children ab37ae0e9cc0
comparison
equal deleted inserted replaced
5:0c2b1fe8f53f 6:ffe01043ecea
15 15
16 class Dispatcher(object): 16 class Dispatcher(object):
17 17
18 ### class level variables 18 ### class level variables
19 defaults = { 'auto_reload': 'False', 19 defaults = { 'auto_reload': 'False',
20 'jquery': 'jquery.js',
20 'template_dirs': '', 21 'template_dirs': '',
21 'seed': '' } 22 'seed': '' }
22 23
23 def __init__(self, **kw): 24 def __init__(self, **kw):
24 25
55 if handler is not None: 56 if handler is not None:
56 break 57 break
57 else: 58 else:
58 handler = exc.HTTPNotFound 59 handler = exc.HTTPNotFound
59 60
60 # add navigation links to handler [example] 61 # add data to handler
61 if hasattr(handler, 'data'): 62 if hasattr(handler, 'data'):
62 handler.data.setdefault('links', []) 63 handler.data['jquery'] = self.jquery
63 for h in self.handlers:
64 handler.data['links'].append((handler.link(h.handler_path),
65 h.__name__))
66 64
67 # get response 65 # get response
68 res = handler() 66 res = handler()
69 return res(environ, start_response) 67 return res(environ, start_response)
70 68