annotate commitwatcher/web/app.py @ 45:32cf3d3469c3 default tip

assert
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 07 Nov 2013 14:19:06 -0800
parents f82331d875f0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 """
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 web handler for CommitWatcher
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 """
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6
28
Jeff Hammel <jhammel@mozilla.com>
parents: 27
diff changeset
7 import os
0
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 from webob import Request, Response, exc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9
28
Jeff Hammel <jhammel@mozilla.com>
parents: 27
diff changeset
10 here = os.path.dirname(os.path.abspath(__file__))
Jeff Hammel <jhammel@mozilla.com>
parents: 27
diff changeset
11
Jeff Hammel <jhammel@mozilla.com>
parents: 27
diff changeset
12 class MercurialFeedServer(object):
Jeff Hammel <jhammel@mozilla.com>
parents: 27
diff changeset
13 """serves file + directory feeds for an hg repo"""
0
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14
25
a5b4025f2455 commitwatcher/web.py
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
15 def __init__(self, repository, **kw):
a5b4025f2455 commitwatcher/web.py
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
16 self.repository = repository
0
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 def __call__(self, environ, start_response):
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 request = Request(environ)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 response = Response(content_type='text/plain',
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 body="CommitWatcher")
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22 return response(environ, start_response)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23
28
Jeff Hammel <jhammel@mozilla.com>
parents: 27
diff changeset
24
Jeff Hammel <jhammel@mozilla.com>
parents: 27
diff changeset
25 def main(args=sys.argv[1:]):
Jeff Hammel <jhammel@mozilla.com>
parents: 27
diff changeset
26 """serve WSGI app"""
0
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27 from wsgiref import simple_server
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
28 app = Handler()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
29 server = simple_server.make_server(host='0.0.0.0', port=8080, app=app)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
30 server.serve_forever()
28
Jeff Hammel <jhammel@mozilla.com>
parents: 27
diff changeset
31
Jeff Hammel <jhammel@mozilla.com>
parents: 27
diff changeset
32 if __name__ == '__main__':
Jeff Hammel <jhammel@mozilla.com>
parents: 27
diff changeset
33 main()