diff options
author | Helmut Grohne <helmut@subdivi.de> | 2016-05-21 17:54:04 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2016-05-21 17:54:04 +0200 |
commit | 4789c77936a634dc717f61309503f99a44b610ed (patch) | |
tree | 40e621b92ae1682709ce1f814ceddcbcebb727bb /webapp.py | |
parent | 4cdf80c2ba2535f9a4a66d1bde6f7ac1b380e3d2 (diff) | |
download | debian-dedup-4789c77936a634dc717f61309503f99a44b610ed.tar.gz |
move from deprecated optparse to argparse
Diffstat (limited to 'webapp.py')
-rwxr-xr-x | webapp.py | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,8 +1,8 @@ #!/usr/bin/python +import argparse import contextlib import datetime -import optparse import sqlite3 from wsgiref.simple_server import make_server @@ -256,12 +256,12 @@ class Application(object): return html_response(source_template.render(params)) def main(): - parser = optparse.OptionParser() - parser.add_option("-d", "--database", action="store", - default="test.sqlite3", - help="path to the sqlite3 database file") - options, args = parser.parse_args() - app = Application(sqlite3.connect(options.database)) + parser = argparse.ArgumentParser() + parser.add_argument("-d", "--database", action="store", + default="test.sqlite3", + help="path to the sqlite3 database file") + args = parser.parse_args() + app = Application(sqlite3.connect(args.database)) app = SharedDataMiddleware(app, {"/static": ("dedup", "static")}) make_server("0.0.0.0", 8800, app).serve_forever() |