#NEWLINE# def register_routes( self ) : #NEWLINE# #INDENT# '\n        Function creates instances of controllers, adds into bottle routes\n        ' #NEWLINE# routes = self . flatten_urls ( self . urls ) #NEWLINE# self . controllers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# controller_names = set ( ) #NEWLINE# for route in routes : #NEWLINE# #INDENT# cname = route [ 'endpoint' ] . split ( '.' ) [ 0 ] #NEWLINE# controller_names . add ( cname ) #NEWLINE# #UNINDENT# for cname in controller_names : #NEWLINE# #INDENT# attr = getattr ( self . mcontrollers , cname ) #NEWLINE# instance = attr ( request , response ) #NEWLINE# self . controllers [ cname ] = instance #NEWLINE# #UNINDENT# for route in routes : #NEWLINE# #INDENT# ( cname , aname ) = route [ 'endpoint' ] . split ( '.' ) #NEWLINE# action = getattr ( self . controllers [ cname ] , aname ) #NEWLINE# self . wsgi . route ( controller_names [ 'url' ] , route [ 'methods' ] , action )