<s> from swift . common . swob import Request , Response <EOL> from swift . common . utils import register_swift_info <EOL> class CrossDomainMiddleware ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , app , conf , * args , ** kwargs ) : <EOL> self . app = app <EOL> self . conf = conf <EOL> default_domain_policy = '<STR_LIT>' '<STR_LIT>' <EOL> self . cross_domain_policy = self . conf . get ( '<STR_LIT>' , <EOL> default_domain_policy ) <EOL> def GET ( self , req ) : <EOL> """<STR_LIT>""" <EOL> body = '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' % self . cross_domain_policy <EOL> return Response ( request = req , body = body , <EOL> content_type = "<STR_LIT>" ) <EOL> def __call__ ( self , env , start_response ) : <EOL> req = Request ( env ) <EOL> if req . path == '<STR_LIT>' and req . method == '<STR_LIT:GET>' : <EOL> return self . GET ( req ) ( env , start_response ) <EOL> else : <EOL> return self . app ( env , start_response ) <EOL> def filter_factory ( global_conf , ** local_conf ) : <EOL> conf = global_conf . copy ( ) <EOL> conf . update ( local_conf ) <EOL> register_swift_info ( '<STR_LIT>' ) <EOL> def crossdomain_filter ( app ) : <EOL> return CrossDomainMiddleware ( app , conf ) <EOL> return crossdomain_filter </s>
