comparison commitwatcher/web/app.py @ 28:f82331d875f0

wip
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 05 Oct 2013 15:38:32 -0700
parents 4568da225eac
children
comparison
equal deleted inserted replaced
27:4568da225eac 28:f82331d875f0
2 2
3 """ 3 """
4 web handler for CommitWatcher 4 web handler for CommitWatcher
5 """ 5 """
6 6
7 import os
7 from webob import Request, Response, exc 8 from webob import Request, Response, exc
8 9
9 class Handler(object): 10 here = os.path.dirname(os.path.abspath(__file__))
11
12 class MercurialFeedServer(object):
13 """serves file + directory feeds for an hg repo"""
10 14
11 def __init__(self, repository, **kw): 15 def __init__(self, repository, **kw):
12 self.repository = repository 16 self.repository = repository
13 17
14 def __call__(self, environ, start_response): 18 def __call__(self, environ, start_response):
15 request = Request(environ) 19 request = Request(environ)
16 response = Response(content_type='text/plain', 20 response = Response(content_type='text/plain',
17 body="CommitWatcher") 21 body="CommitWatcher")
18 return response(environ, start_response) 22 return response(environ, start_response)
19 23
20 if __name__ == '__main__': 24
25 def main(args=sys.argv[1:]):
26 """serve WSGI app"""
21 from wsgiref import simple_server 27 from wsgiref import simple_server
22 app = Handler() 28 app = Handler()
23 server = simple_server.make_server(host='0.0.0.0', port=8080, app=app) 29 server = simple_server.make_server(host='0.0.0.0', port=8080, app=app)
24 server.serve_forever() 30 server.serve_forever()
31
32 if __name__ == '__main__':
33 main()