<s> __author__ = '<STR_LIT>' <EOL> from functools import wraps <EOL> def crossdomain ( func , allow_origin = None , allow_headers = None , max_age = None ) : <EOL> """<STR_LIT>""" <EOL> if not allow_origin : <EOL> allow_origin = "<STR_LIT:*>" <EOL> if not allow_headers : <EOL> allow_headers = "<STR_LIT>" <EOL> if not max_age : <EOL> max_age = <NUM_LIT> <EOL> @ wraps ( func ) <EOL> def wrapper ( * args , ** kwargs ) : <EOL> response = func ( * args , ** kwargs ) <EOL> cors_headers = { <EOL> "<STR_LIT>" : allow_origin , <EOL> "<STR_LIT>" : func . __name__ . upper ( ) , <EOL> "<STR_LIT>" : allow_headers , <EOL> "<STR_LIT>" : max_age , <EOL> } <EOL> if isinstance ( response , tuple ) : <EOL> if len ( response ) == <NUM_LIT:3> : <EOL> headers = response [ - <NUM_LIT:1> ] <EOL> else : <EOL> headers = { } <EOL> headers . update ( cors_headers ) <EOL> return response [ <NUM_LIT:0> ] , response [ <NUM_LIT:1> ] , headers <EOL> else : <EOL> return response , <NUM_LIT:200> , cors_headers <EOL> return wrapper </s>
