#NEWLINE# def route( self , req , node , path ) : #NEWLINE# #INDENT# '\n        Looks up a controller from a node based upon the specified path.\n\n        :param node: The node, such as a root controller object.\n        :param path: The path to look up on this node.\n        ' #NEWLINE# path = path . split ( '/' ) [ 1 : ] #NEWLINE# try : #NEWLINE# #INDENT# ( node , remainder ) = lookup_controller ( node , path , req ) #NEWLINE# return ( node , remainder ) #NEWLINE# #UNINDENT# except NonCanonicalPath as e : #NEWLINE# #INDENT# if ( self . force_canonical and ( not _cfg ( e . controller ) . get ( 'accept_noncanonical' , False ) ) ) : #NEWLINE# #INDENT# if ( req . method == 'POST' ) : #NEWLINE# #INDENT# raise RuntimeError ( ( "You have POSTed to a URL '%s' which requires a slash. Most browsers will not maintain POST data when redirected. Please update your code to POST to '%s/' or set force_canonical to False" % ( req . pecan [ 'routing_path' ] , req . pecan [ 'routing_path' ] ) ) ) #NEWLINE# #UNINDENT# redirect ( code = 302 , add_slash = True , request = req ) #NEWLINE# #UNINDENT# return ( e . controller , e . remainder )