def sanitycheck_view(request): """An admin view for manual sanity checks.""" app_assets.need() warnings = run_all_checks(request) return { 'warnings': warnings, }
def __call__(self): """BIMT-specific override of :meth:`pyramid_deform.FormView.__call__()`. Along with calling ``super().__call__()`` to get all the benefits of underlying :class:`pyramid_deform.FormView` class, this method also does the following: * `requires` static resources needed to render a form in a BIMT app, * hides the sidebar if ``self.hide_sidebar`` is True, * sets ``self.title`` so the ``form.pt`` template can use it. :returns: result from :meth:`pyramid_deform.FormView.__call__()` """ app_assets.need() form_assets.need() if getattr(self, 'hide_sidebar', None) and self.hide_sidebar: self.request.layout_manager.layout.hide_sidebar = True result = super(FormView, self).__call__() if isinstance(result, dict): # pragma: no branch result['title'] = self.title self.request.layout_manager.layout.title = self.title result['description'] = getattr(self, 'description', None) result['above_form'] = getattr(self, 'above_form', None) return result
def raise_js_error(request): app_assets.need() return { 'title': 'JS error', 'form': """<script type="text/javascript"> throw new Error('[{now}] Error test.'); </script> <p>[{now}] Error test.</p>""".format(now=datetime.utcnow()) }
def config(request): app_assets.need() request.layout_manager.layout.hide_sidebar = True settings = sorted(request.registry.settings.items(), key=lambda x: x[0]) environ = sorted(os.environ.items(), key=lambda x: x[0]) return { 'title': 'Config', 'environ': environ, 'settings': settings, 'secrets': [ 'BROKER_URL', 'CELERY_RESULT_BACKEND', 'authtkt.secret', 'bimt.jvzoo_secret_key', 'bimt.clickbank_secret_key', 'bimt.flower_auth', 'session.secret', 'DATABASE_URL', 'SENTRY_DSN', ] }
def __init__(self, context, request): self.request = request self.context = context app_assets.need()