summaryrefslogtreecommitdiff
path: root/webapp.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2013-02-25 11:52:05 +0100
committerHelmut Grohne <helmut@subdivi.de>2013-02-25 11:52:05 +0100
commit187a58b390a770be554c26a75e9127ebee1858b9 (patch)
tree528fad103bac0652c90754b6f70e0b1018e42e37 /webapp.py
parentaaee48294adbd81245d1c22bf0acbd5cd447ec89 (diff)
downloaddebian-dedup-187a58b390a770be554c26a75e9127ebee1858b9.tar.gz
webapp: pass database to Application class
Diffstat (limited to 'webapp.py')
-rwxr-xr-xwebapp.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/webapp.py b/webapp.py
index a215dd5..5ba9ec4 100755
--- a/webapp.py
+++ b/webapp.py
@@ -130,8 +130,8 @@ def html_response(unicode_iterator, max_age=24 * 60 * 60):
return resp
class Application(object):
- def __init__(self):
- self.db = sqlite3.connect("test.sqlite3")
+ def __init__(self, db):
+ self.db = db
self.cur = self.db.cursor()
self.routingmap = Map([
Rule("/", methods=("GET",), endpoint="index"),
@@ -256,7 +256,7 @@ class Application(object):
return html_response(hash_template.render(params))
def main():
- app = Application()
+ app = Application(sqlite3.connect("test.sqlite3"))
#app = DebuggedApplication(app, evalex=True)
make_server("0.0.0.0", 8800, app).serve_forever()