# HG changeset patch # User Jeff Hammel # Date 1388117490 28800 # Node ID e5efb021a8e6af209765bc66d3c9a79985aaad30 # Parent bdb005ae848b14173a421136d1651142ab39cb65 example/persona.py diff -r bdb005ae848b -r e5efb021a8e6 example/persona.py --- a/example/persona.py Thu Dec 26 20:06:49 2013 -0800 +++ b/example/persona.py Thu Dec 26 20:11:30 2013 -0800 @@ -1,18 +1,24 @@ #!/usr/bin/env python -import optparse -import os -import sys - """ test Mozilla persona auth https://login.persona.org/about """ +import optparse +import os +import sys +from wsgiref import simple_server + here = os.path.dirname(os.path.realpath(__file__)) page = os.path.join(here, 'persona.html') +class PersonaTest(object): + def __init__(self, page): + self.page = page or globals()['page'] + assert os.path.exists(self.page) + def main(args=sys.argv[1:]): usage = '%prog [options]' @@ -22,7 +28,12 @@ help="port to serve on") options, args = parser.parse_args(args) - + server = simple_server.make_server('127.0.0.1', options.port, app) + print 'server on http://localhost:8080' + try: + server.serve_forever() + except KeyboardInterrupt: + pass if __name__ == '__main__': main()