<s> """<STR_LIT>""" <EOL> from beaker . middleware import SessionMiddleware <EOL> from paste . cascade import Cascade <EOL> from paste . registry import RegistryManager <EOL> from paste . urlparser import StaticURLParser <EOL> from paste . deploy . converters import asbool <EOL> from pylons . middleware import ErrorHandler , StatusCodeRedirect <EOL> from pylons . wsgiapp import PylonsApp <EOL> from routes . middleware import RoutesMiddleware <EOL> from nipapwww . config . environment import load_environment <EOL> def make_app ( global_conf , full_stack = True , static_files = True , ** app_conf ) : <EOL> """<STR_LIT>""" <EOL> config = load_environment ( global_conf , app_conf ) <EOL> app = PylonsApp ( config = config ) <EOL> app = RoutesMiddleware ( app , config [ '<STR_LIT>' ] , singleton = False ) <EOL> app = SessionMiddleware ( app , config ) <EOL> if asbool ( full_stack ) : <EOL> app = ErrorHandler ( app , global_conf , ** config [ '<STR_LIT>' ] ) <EOL> if asbool ( config [ '<STR_LIT>' ] ) : <EOL> app = StatusCodeRedirect ( app ) <EOL> else : <EOL> app = StatusCodeRedirect ( app , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> app = RegistryManager ( app ) <EOL> if asbool ( static_files ) : <EOL> static_app = StaticURLParser ( config [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> app = Cascade ( [ static_app , app ] ) <EOL> app . config = config <EOL> return app </s>
