import mitsql
from cheetah import templates
import cherrypy
from pprint import pformat
def _500(*argv, **kw):
s_exc = cherrypy._cperror.format_exc()
mitsql.logging.error(s_exc)
return templates.common.shell(title='%s (CherryPy %s)' % (kw.get('status'), kw.get('version')),
content=('
%s
' + (2*''))
% (kw.get('message'), kw.get('traceback'),
_phtml(dict(filter(lambda x: not x[0][:2] == '__',
cherrypy.request.__dict__.items())))))
class Root(object):
class Error(object):
@cherrypy.expose
def _404(*argv, **kw):
return templates.common._404()
def _500(*argv, **kw):
return _500(*argv, **kw)
error = Error()
class DB(object):
def list(*argv, **kw):
r = {'db_list': [],
'size_tot': '1M',
'size_max': '100M',
'user': {
'db_prefix': 'presbrey+'
}}
return templates.main.db_list(**r)
list.exposed = True
db = DB()
def test(self, *argv, **kw):
cherrypy.response.headers['Content-type'] = 'text/plain'
return pformat(dict(filter(lambda x: not x[0][:2] == '__', cherrypy.request.__dict__.items())))
test.exposed = True
def index(self, *argv, **kw):
return templates.main.index()
index.exposed = True
def passwd(self, *argv, **kw):
return templates.main.passwd()
passwd.exposed = True