Skip to content

Instantly share code, notes, and snippets.



Created Aug 16, 2016
What would you like to do?
Pyramid 1.7 view deriver to alert on view_configs that lack a permission setting.
def permission_check(view, info):
"""View deriver to verify all view configs define a 'permission'.
This deriver prints a message for each view config that lacks a permission
setting. Regardless of this setting, the original view is returned.
opts = info.options
if opts.get('permission') is None:
name_parts = [opts['view'].__module__, opts['view'].__name__]
if opts['attr'] is not None:
print('{}: no permission defined ¯\_(ツ)_/¯'.format('.'.join(func)))
return view
def main(global_config, **settings):
config = Configurator(settings=settings)
# Everything else to set up and return your wsgi app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.