#NEWLINE# def setup_app( pecan_config = None , extra_hooks = None ) : #NEWLINE# #INDENT# app_hooks = [ hooks . ConfigHook ( ) , hooks . DBHook ( ) , hooks . ContextHook ( pecan_config . app . acl_public_routes ) , hooks . RPCHook ( ) , hooks . NoExceptionTracebackHook ( ) , hooks . PublicUrlHook ( ) ] #NEWLINE# if extra_hooks : #NEWLINE# #INDENT# app_hooks . extend ( extra_hooks ) #NEWLINE# #UNINDENT# if ( not pecan_config ) : #NEWLINE# #INDENT# pecan_config = get_pecan_config ( ) #NEWLINE# #UNINDENT# if pecan_config . app . enable_acl : #NEWLINE# #INDENT# app_hooks . append ( hooks . TrustedCallHook ( ) ) #NEWLINE# #UNINDENT# pecan . configuration . set_config ( dict ( pecan_config ) , overwrite = True ) #NEWLINE# app = pecan . make_app ( pecan_config . app . root , static_root = pecan_config . app . static_root , debug = CONF . pecan_debug , force_canonical = getattr ( pecan_config . app , 'force_canonical' , True ) , hooks = app , wrap_app = middleware . ParsableErrorMiddleware ) #NEWLINE# if pecan_config . app . enable_acl : #NEWLINE# #INDENT# app = acl . install ( app , cfg . CONF , pecan_config . app . acl_public_routes ) #NEWLINE# #UNINDENT# app = cors_middleware . CORS ( app , CONF ) #NEWLINE# app . set_latent ( allow_headers = [ Version . max_string , Version . min_string , Version . string ] , allow_methods = [ 'GET' , 'PUT' , 'POST' , 'DELETE' , 'PATCH' ] , expose_headers = [ Version . max_string , Version . min_string , Version . string ] ) #NEWLINE# return app