Skip to content

Instantly share code, notes, and snippets.

@atroche
Created July 26, 2011 10:45
Show Gist options
  • Save atroche/1106473 to your computer and use it in GitHub Desktop.
Save atroche/1106473 to your computer and use it in GitHub Desktop.
from werkzeug import find_modules, import_string
def find_secure_views():
modules = [import_string(module_name) for module_name in
find_modules("streetbook", include_packages=True, recursive=True)
if 'views' in module_name]
for module in modules:
for k, v in module.__dict__.items():
decorators = getattr(v, 'decorators', tuple())
if type(decorators) != list:
continue
secure_required = [dec for dec in decorators
if dec.__name__ == "secure_required"]
if secure_required:
print '%s.%s' % (module.__name__, k)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment