Jump to >

reviewboard.site.urlresolvers

local_site_reverse(viewname, request=None, local_site_name=None, local_site=None, args=None, kwargs=None, *func_args, **func_kwargs)[source]

Reverse a URL name and return a working URL.

This works much like Django’s reverse(), but handles returning a LocalSite version of a URL when invoked with one of the following:

  • A request argument, representing an HTTP request to a URL within a LocalSite.
  • A local_site_name argument, indicating the name of the local site.
  • A local_site argument.
Parameters:
  • viewname (unicode) – The name of the view to generate a URL for.
  • request (django.http.HttpRequest, optional) – The current HTTP request. The current local site can be extracted from this.
  • local_site_name (unicode, optional) – The name of the local site.
  • local_site (reviewboard.site.models.LocalSite, optional) – The local site.
  • args (list, optional) – Positional arguments to use for reversing in reverse().
  • kwargs (dict, optional) –
    Keyword arguments to use for reversing in
    reverse().
  • func_args (tuple, optional) – Additional positional arguments to pass to reverse().
  • func_kwargs (dict, optional) – Additional keyword arguments to pass to reverse().
Returns:

The reversed URL.

Return type:

unicode

Raises:

django.core.urlresolvers.NoReverseMatch – Raised when there is no URL matching the view and arguments.