debug.py 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # -*- coding: utf-8 -*-
  2. """Main Controller"""
  3. from tg import expose, flash, require, url, lurl, request, redirect, tmpl_context
  4. from tg.i18n import ugettext as _, lazy_ugettext as l_
  5. from tg import predicates
  6. from pboard import model
  7. from pboard.controllers.secure import SecureController
  8. from pboard.model import DBSession, metadata
  9. from pboard.lib.base import BaseController
  10. from pboard.controllers.error import ErrorController
  11. import pboard.model as pbm
  12. import pboard.controllers as pbc
  13. from pboard.lib import dbapi as pld
  14. from pboard.controllers import api as pbca
  15. import pboard.model.data as pbmd
  16. __all__ = ['DebugController']
  17. class DebugController(BaseController):
  18. allow_only = predicates.in_group('admin',
  19. msg=l_('You\'re not allowed to access this page'))
  20. @expose('pboard.templates.debug.iconset')
  21. def iconset(self, **kw):
  22. """This method showcases how you can use the same controller for a data page and a display page"""
  23. return dict()
  24. @expose('pboard.templates.debug.environ')
  25. def environ(self, **kw):
  26. """This method showcases TG's access to the wsgi environment."""
  27. return dict(environment=request.environ)
  28. @expose('pboard.templates.debug.identity')
  29. def identity(self, **kw):
  30. """This method showcases TG's access to the wsgi environment."""
  31. return dict(identity=request.identity)