Created
July 26, 2011 10:45
-
-
Save atroche/1106473 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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