def add(self, pattern, method=None, call=None, name=None):
        """Add a url pattern.

        Args:
            pattern (:obj:`str`): URL pattern to add. This is usually '/'
                separated path. Parts of the URL can be parameterised using
                curly braces.
                Examples: "/", "/path/to/resource", "/resoures/{param}"
            method (:obj:`str`, :obj:`list` of :obj:`str`, optional): HTTP
                methods for the path specied. By default, GET method is added.
                Value can be either a single method, by passing a string, or
                multiple methods, by passing a list of strings.
            call (callable): Callable corresponding to the url pattern and the
                HTTP method specified.
            name (:obj:`str`): Name for the pattern that can be used for
                reverse matching

        Note:
            A trailing '/' is always assumed in the pattern.
        """
        if not pattern.endswith('/'):
            pattern += '/'
        parts = tuple(pattern.split('/')[1:])
        node = self._routes
        for part in parts:
            node = node.setdefault(part, {})
        if method is None:
            node['GET'] = call
        elif isinstance(method, str):
            node[method.upper()] = call
        else:
            for m in method:
                node[m.upper()] = call

        if name is not None:
            self._reverse[name] = pattern
def add ( self , pattern , method = None , call = None , name = None ) : if not pattern . endswith ( '/' ) : pattern += '/' parts = tuple ( pattern . split ( '/' ) [ 1 : ] ) node = self . _routes for part in parts : node = node . setdefault ( part , { } ) if method is None : node [ 'GET' ] = call elif isinstance ( method , str ) : node [ method . upper ( ) ] = call else : for m in method : node [ m . upper ( ) ] = call if name is not None : self . _reverse [ name ] = pattern
Add a url pattern.

        Args:
            pattern (:obj:`str`): URL pattern to add. This is usually '/'
                separated path. Parts of the URL can be parameterised using
                curly braces.
                Examples: "/", "/path/to/resource", "/resoures/{param}"
            method (:obj:`str`, :obj:`list` of :obj:`str`, optional): HTTP
                methods for the path specied. By default, GET method is added.
                Value can be either a single method, by passing a string, or
                multiple methods, by passing a list of strings.
            call (callable): Callable corresponding to the url pattern and the
                HTTP method specified.
            name (:obj:`str`): Name for the pattern that can be used for
                reverse matching

        Note:
            A trailing '/' is always assumed in the pattern.