#NEWLINE# def add_route( self , uri_template , resource , * args , **kwargs ) : #NEWLINE# #INDENT# 'Associates a templatized URI path with a resource.\n\n        A resource is an instance of a class that defines various\n        "responder" methods, one for each HTTP method the resource\n        allows. Responder names start with `on_` and are named according to\n        which HTTP method they handle, as in `on_get`, `on_post`, `on_put`,\n        etc.\n\n        If your resource does not support a particular\n        HTTP method, simply omit the corresponding responder and\n        Falcon will reply with "405 Method not allowed" if that\n        method is ever requested.\n\n        Responders must always define at least two arguments to receive\n        request and response objects, respectively. For example::\n\n            def on_post(self, req, resp):\n                pass\n\n        In addition, if the route\'s template contains field\n        expressions, any responder that desires to receive requests\n        for that route must accept arguments named after the respective\n        field names defined in the template. A field expression consists\n        of a bracketed field name.\n\n        For example, given the following template::\n\n            /user/{name}\n\n        A PUT request to "/user/kgriffs" would be routed to::\n\n            def on_put(self, req, resp, name):\n                pass\n\n        Individual path segments may contain one or more field expressions.\n        For example::\n\n            /repos/{org}/{repo}/compare/{usr0}:{branch0}...{usr1}:{branch1}\n\n        Args:\n            uri_template (str): A templatized URI. Care must be\n                taken to ensure the template does not mask any sink\n                patterns, if any are registered (see also `add_sink`).\n            resource (instance): Object which represents a REST\n                resource. Falcon will pass "GET" requests to on_get,\n                "PUT" requests to on_put, etc. If any HTTP methods are not\n                supported by your resource, simply don\'t define the\n                corresponding request handlers, and Falcon will do the right\n                thing.\n\n        Note:\n            Any additional args and kwargs not defined above are passed\n            through to the underlying router\'s ``add_route()`` method. The\n            default router does not expect any additional arguments, but\n            custom routers may take advantage of this feature to receive\n            additional options when setting up routes.\n\n        ' #NEWLINE# if ( not isinstance ( uri_template , six . string_types ) ) : #NEWLINE# #INDENT# raise TypeError ( 'uri_template is not a string' ) #NEWLINE# #UNINDENT# if ( not uri_template . startswith ( '/' ) ) : #NEWLINE# #INDENT# raise ValueError ( "uri_template must start with '/'" ) #NEWLINE# #UNINDENT# if ( '//' in uri_template ) : #NEWLINE# #INDENT# raise ValueError ( "uri_template may not contain '//'" ) #NEWLINE# #UNINDENT# method_map = routing . create_http_method_map ( resource ) #NEWLINE# self . _router . add_route ( uri_template , method_map , resource , * args , ** kwargs )