Created pydev project, further cleanup, gitignored db.

This commit is contained in:
ultra
2012-03-01 19:37:30 -05:00
parent cd23844bec
commit 7432d55ce0
4 changed files with 33 additions and 6 deletions

View File

@@ -1,10 +1,9 @@
#!/usr/bin/python2
from bottle import get, post, request, run, route, static_file, default_app
import json
import anydbm as dbm
import os
import anydbm
data = dbm.open("cryptopad.db", 'c');
data = anydbm.open("cryptopad.db", 'c');
@get("/storage/<key>")
def getItem(key):
@@ -12,14 +11,14 @@ def getItem(key):
return json.dumps(data[key])
else:
return json.dumps(None)
@get("/storage/delete/<key>")
def delete(key):
if (data.has_key(key)):
del data[key]
@post("/storage/<key>")
def set(key):
def setItem(key):
data[key] = request.forms.get("value")
@get("/<filepath:path>")
@@ -33,4 +32,4 @@ def index():
application=default_app()
if __name__ == "__main__":
run(application, host='localhost', port=55580)
run(application, host='localhost', port=55580)