#NEWLINE# def dispatch_request( self , * args , **kwargs ) : #NEWLINE# #INDENT# if ( not check_ip ( request ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# objResponse = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# objResponse [ 'template_tag' ] = ( '' if ( self . action . pi_api_template == '' ) else md5Checksum ( ( 'templates/' + self . action . pi_api_template ) ) ) #NEWLINE# for attribute in ( 'only_logged_user' , 'only_member_user' , 'only_admin_user' , 'only_orga_member_user' , 'only_orga_admin_user' , 'cache_time' , 'cache_by_user' , 'user_info' , 'json_only' , 'no_template' ) : #NEWLINE# #INDENT# if hasattr ( self . action , ( 'pi_api_' + attribute ) ) : #NEWLINE# #INDENT# objResponse [ attribute ] = getattr ( self . action , ( 'pi_api_' + attribute ) ) #NEWLINE# #UNINDENT# #UNINDENT# response = make_response ( jsonify ( objResponse ) ) #NEWLINE# expires = ( datetime . utcnow ( ) + timedelta ( seconds = PI_META_CACHE ) ) #NEWLINE# expires = expires . strftime ( '%a, %d %b %Y %H:%M:%S GMT' ) #NEWLINE# response . headers [ 'Expire' ] = expires #NEWLINE# response . headers [ 'Cache-Control' ] = ( 'public, max-age=' + str ( PI_META_CACHE ) ) #NEWLINE# return response