'Resolve other_url relative to the request URL.
If ``to_application`` is True, then resolve it relative to the
URL with only SCRIPT_NAME'

def relative_url(self, other_url, to_application=False):

    if to_application:
        url = self.application_url
        if (not url.endswith('/')):
            url += '/'
    else:
        url = self.path_url
    return urlparse.urljoin(url, other_url)
