0
|
1 import os
|
|
2
|
|
3 from middleware import Commentator
|
|
4 from paste.httpexceptions import HTTPExceptionHandler
|
|
5 from paste.urlparser import StaticURLParser
|
|
6 from pkg_resources import resource_filename
|
|
7
|
|
8
|
|
9 def factory(global_conf, **app_conf):
|
|
10 """create a webob view and wrap it in middleware"""
|
|
11
|
|
12 keystr = 'commentator.'
|
|
13 args = dict([(key.split(keystr, 1)[-1], value)
|
|
14 for key, value in app_conf.items()
|
|
15 if key.startswith(keystr) ])
|
|
16 app = StaticURLParser(app_conf['directory'])
|
|
17 commentator = Commentator(app, **args)
|
|
18 return HTTPExceptionHandler(commentator)
|
|
19
|