]> andersk Git - sql.git/blob - lib/python/mitsql/interface/handler.py
implemented base interface
[sql.git] / lib / python / mitsql / interface / handler.py
1 import mitsql
2 from cheetah import templates
3 import cherrypy
4
5 from pprint import pformat
6
7 def _500(*argv, **kw):
8     s_exc = cherrypy._cperror.format_exc()
9     mitsql.logging.error(s_exc)
10     return templates.common.shell(title='%s (CherryPy %s)' % (kw.get('status'), kw.get('version')),
11                                   content=('<p>%s</p>' + (2*'<div><pre>%s</pre></div>'))
12                                   % (kw.get('message'), kw.get('traceback'),
13                                      _phtml(dict(filter(lambda x: not x[0][:2] == '__',
14                                                         cherrypy.request.__dict__.items())))))
15
16 class Root(object):
17     class Error(object):
18         @cherrypy.expose
19         def _404(*argv, **kw):
20             return templates.common._404()
21         def _500(*argv, **kw):
22             return _500(*argv, **kw)
23     error = Error()
24     
25     class DB(object):
26         def list(*argv, **kw):
27             r = {'db_list': [],
28                  'size_tot': '1M',
29                  'size_max': '100M',
30                  'user': {
31                  'db_prefix': 'presbrey+'
32                  }}
33             return templates.main.db_list(**r)
34         list.exposed = True
35     db = DB()
36
37     def test(self, *argv, **kw):
38         cherrypy.response.headers['Content-type'] = 'text/plain'
39         return pformat(dict(filter(lambda x: not x[0][:2] == '__', cherrypy.request.__dict__.items())))
40     test.exposed = True
41
42     def index(self, *argv, **kw):
43         return templates.main.index()
44     index.exposed = True
45     
46     def passwd(self, *argv, **kw):
47         return templates.main.passwd()
48     passwd.exposed = True
This page took 0.05953 seconds and 5 git commands to generate.