<s> import inspect <EOL> import functools <EOL> from optparse import make_option <EOL> from django . conf import settings <EOL> from django . core . management . base import BaseCommand , CommandError <EOL> from django . contrib . admindocs . views import simplify_regex <EOL> from djangae . contrib . security . commands_utils import ( <EOL> extract_views_from_urlpatterns , <EOL> display_as_table , <EOL> get_func_name , <EOL> get_decorators , <EOL> get_mixins , <EOL> simplify_regex , <EOL> ) <EOL> DEFAULT_IGNORED_MODULES = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> class Command ( BaseCommand ) : <EOL> args = "<STR_LIT>" <EOL> help = "<STR_LIT>" <EOL> def handle ( self , * args , ** options ) : <EOL> ignored_modules = args if args else DEFAULT_IGNORED_MODULES <EOL> views = [ ] <EOL> urlconf = __import__ ( settings . ROOT_URLCONF , { } , { } , [ '<STR_LIT>' ] ) <EOL> view_functions = extract_views_from_urlpatterns ( urlconf . urlpatterns , ignored_modules = ignored_modules ) <EOL> for ( func , regex , url_name ) in view_functions : <EOL> if isinstance ( func , functools . partial ) : <EOL> func = func . func <EOL> decorators_and_mixins = get_decorators ( func ) + get_mixins ( func , ignored_modules = ignored_modules ) <EOL> views . append ( "<STR_LIT>" . format ( <EOL> module = '<STR_LIT>' . format ( func . __module__ , get_func_name ( func ) ) , <EOL> url = simplify_regex ( regex ) , <EOL> decorators = '<STR_LIT:U+002CU+0020>' . join ( decorators_and_mixins ) <EOL> ) ) <EOL> info = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) <EOL> table = display_as_table ( views ) <EOL> return "<STR_LIT>" . format ( table , info ) </s>
