view 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
line wrap: on
line source

#!/usr/bin/env python

"""
web handler for CommitWatcher
"""

import os
from webob import Request, Response, exc

here = os.path.dirname(os.path.abspath(__file__))

class MercurialFeedServer(object):
    """serves file + directory feeds for an hg repo"""

    def __init__(self, repository, **kw):
        self.repository = repository

    def __call__(self, environ, start_response):
        request = Request(environ)
        response = Response(content_type='text/plain',
                            body="CommitWatcher")
        return response(environ, start_response)


def main(args=sys.argv[1:]):
    """serve WSGI app"""
    from wsgiref import simple_server
    app = Handler()
    server = simple_server.make_server(host='0.0.0.0', port=8080, app=app)
    server.serve_forever()

if __name__ == '__main__':
    main()