# easy_install ZODB3
# easy_install cherrypy
import cherrypy
import cgi
from ZODB import FileStorage, DB
import transaction
class MyZODB(object):
def __init__(self, path):
self.storage = FileStorage.FileStorage(path)
self.db = DB(self.storage)
self.connection = self.db.open()
self.dbroot = self.connection.root()
def close(self):
self.connection.close()
self.db.close()
self.storage.close()
def ehtml(s):
return cgi.escape(s)
class HelloWorld(object):
def index(self):
# list everything passed, and allow adding more.
r = ""
for k,v in dbroot.items():
r += "k:%s: v:%s:
" % (ehtml(k), ehtml(v))
r += "