

@register.tag
def url(parser, token):
    '\n    Returns an absolute URL matching given view with its parameters.\n\n    This is a way to define links that aren\'t tied to a particular URL\n    configuration::\n\n        {% url "path.to.some_view" arg1 arg2 %}\n\n        or\n\n        {% url "path.to.some_view" name1=value1 name2=value2 %}\n\n    The first argument is a path to a view. It can be an absolute Python path\n    or just ``app_name.view_name`` without the project name if the view is\n    located inside the project.\n\n    Other arguments are space-separated values that will be filled in place of\n    positional and keyword arguments in the URL. Don\'t mix positional and\n    keyword arguments.\n\n    All arguments for the URL should be present.\n\n    For example if you have a view ``app_name.client`` taking client\'s id and\n    the corresponding line in a URLconf looks like this::\n\n        (\'^client/(\\d+)/$\', \'app_name.client\')\n\n    and this app\'s URLconf is included into the project\'s URLconf under some\n    path::\n\n        (\'^clients/\', include(\'project_name.app_name.urls\'))\n\n    then in a template you can create a link for a certain client like this::\n\n        {% url "app_name.client" client.id %}\n\n    The URL will look like ``/clients/client/123/``.\n\n    The first argument can also be a named URL instead of the Python path to\n    the view callable. For example if the URLconf entry looks like this::\n\n        url(\'^client/(\\d+)/$\', name=\'client-detail-view\')\n\n    then in the template you can use::\n\n        {% url "client-detail-view" client.id %}\n\n    There is even another possible value type for the first argument. It can be\n    the name of a template variable that will be evaluated to obtain the view\n    name or the URL name, e.g.::\n\n        {% with view_path="app_name.client" %}\n        {% url view_path client.id %}\n        {% endwith %}\n\n        or,\n\n        {% with url_name="client-detail-view" %}\n        {% url url_name client.id %}\n        {% endwith %}\n\n    '
    bits = token.split_contents()
    if (len(bits) < 2):
        raise TemplateSyntaxError(("'%s' takes at least one argument (path to a view)" % bits[0]))
    viewname = parser.compile_filter(bits[1])
    args = []
    kwargs = {
        
    }
    asvar = None
    bits = bits[2:]
    if ((len(bits) >= 2) and (bits[(- 2)] == 'as')):
        asvar = bits[(- 1)]
        bits = bits[:(- 2)]
    if len(bits):
        for bit in bits:
            match = kwarg_re.match(bit)
            if (not match):
                raise TemplateSyntaxError('Malformed arguments to url tag')
            (name, value) = match.groups()
            if name:
                kwargs[name] = parser.compile_filter(value)
            else:
                args.append(parser.compile_filter(value))
    return URLNode(viewname, args, kwargs, asvar, legacy_view_name=False)

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/templatetags/future.py url/original