#NEWLINE# def __call__( self , i , default = DEFAULT , cast = None , otherwise = None ) : #NEWLINE# #INDENT# "\n        request.args(0,default=0,cast=int,otherwise='http://error_url')\n        request.args(0,default=0,cast=int,otherwise=lambda:...)\n        " #NEWLINE# n = len ( self ) #NEWLINE# if ( ( 0 <= i < n ) or ( ( - n ) <= i < 0 ) ) : #NEWLINE# #INDENT# value = self [ i ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( default is DEFAULT ) : #NEWLINE# #INDENT# value = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( value , cast ) = ( default , False ) #NEWLINE# #UNINDENT# #UNINDENT# if cast : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# value = cast ( value ) #NEWLINE# #UNINDENT# except ( ValueError , TypeError ) : #NEWLINE# #INDENT# from http import HTTP , redirect #NEWLINE# if ( otherwise is None ) : #NEWLINE# #INDENT# raise HTTP ( 404 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( otherwise , str ) : #NEWLINE# #INDENT# redirect ( otherwise ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if callable ( otherwise ) : #NEWLINE# #INDENT# return otherwise ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise RuntimeError ( 'invalid otherwise' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return value