def by_url_key(cls, url): maxlen = 250 template = "byurl(%s,%s)" keyurl = _force_utf8(base_url(url.lower())) hexdigest = md5(keyurl).hexdigest() usable_len = maxlen - len(template) - len(hexdigest) return template % (hexdigest, keyurl[:usable_len])
def new_by_url_key(url): maxlen = 250 template = 'byurl(%s,%s)' keyurl = _force_utf8(base_url(url.lower())) hexdigest = md5(keyurl).hexdigest() usable_len = maxlen - len(template) - len(hexdigest) return template % (hexdigest, keyurl[:usable_len])
def by_url_key(cls, url): return base_url(url.lower()).encode('utf8')
def by_url_key(cls, url): b = base_url(url.lower()) try: return b.encode('utf8') except UnicodeDecodeError: return str(b)
def _by_url_cache(cls, url, sr): q = cls._query(base_url(lower(cls.c.url)) == utils.base_url(url.lower())) if sr: q._filter(cls.c.sr_id == sr._id) q = list(q) return [l._id for l in q]
def old_by_url_key(url): prefix = 'byurl_' s = _force_utf8(base_url(url.lower())) return '%s%s' % (prefix, s)
def by_url_key(url, prefix=''): s = _force_utf8(base_url(url.lower())) return '%s%s' % (prefix, s)
def by_url_key(cls, url): return str(base_url(url.lower()))
def old_by_url_key(url): prefix='byurl_' s = _force_utf8(base_url(url.lower())) return '%s%s' % (prefix, s)