예제 #1
0
    def normalize_url(self, url, charset='utf-8'):
        url = encode(url, charset, 'ignore')
        scheme, netloc, path, qs, anchor = urlsplit(url)

        # Encode to utf8 to prevent urllib KeyError
        path = encode(path, charset, 'ignore')

        path = quote(path, '/%')
        qs = quote_plus(qs, ':&%=')

        return urlparse.urlunsplit((scheme, netloc, path, qs, anchor))
예제 #2
0
    def normalize_url(self, url, charset='utf-8'):
        url = encode(url, charset, 'ignore')
        scheme, netloc, path, qs, anchor = urlsplit(url)

        # Encode to utf8 to prevent urllib KeyError
        path = encode(path, charset, 'ignore')

        path = quote(path, '/%')
        qs = quote_plus(qs, ':&%=')

        return urlparse.urlunsplit((scheme, netloc, path, qs, anchor))
예제 #3
0
def tokey(*args):
    """
    Computes a unique key from arguments given.
    """
    salt = '||'.join([smart_text(arg) for arg in args])
    hash_ = hashlib.md5(encode(salt))
    return hash_.hexdigest()
예제 #4
0
def tokey(*args):
    """
    Computes a unique key from arguments given.
    """
    salt = "||".join([force_text(arg) for arg in args])
    hash_ = hashlib.md5(encode(salt))
    return hash_.hexdigest()
예제 #5
0
def tokey(*args):
    """
    Computes a (hopefully) unique key from arguments given.
    """
    salt = '||'.join([smart_str(arg) for arg in args])
    hash_ = hashlib.md5(encode(salt))
    return hash_.hexdigest()
예제 #6
0
파일: images.py 프로젝트: riros/lanzeva.ru
    def normalize_url(self, url, charset='utf-8'):
        url = encode(url, charset, 'ignore')
        scheme, netloc, path, qs, anchor = urlsplit(url)

        path = quote(path, b'/%')
        qs = quote_plus(qs, b':&%=')

        return urlparse.urlunsplit((scheme, netloc, path, qs, anchor))
예제 #7
0
    def normalize_url(self, url, charset='utf-8'):
        url = encode(url, charset, 'ignore')
        scheme, netloc, path, qs, anchor = urlsplit(url)

        path = quote(path, b'/%')
        qs = quote_plus(qs, b':&%=')

        return urlparse.urlunsplit((scheme, netloc, path, qs, anchor))
예제 #8
0
    def normalize_url(self, url, charset="utf-8"):
        url = encode(url, charset, "ignore")
        scheme, netloc, path, qs, anchor = urlsplit(url)

        path = quote(path, b"/%")
        qs = quote_plus(qs, b":&%=")

        return urlparse.urlunsplit((scheme, netloc, path, qs, anchor))