Esempio n. 1
0
 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])
Esempio n. 2
0
 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])
Esempio n. 3
0
 def by_url_key(cls, url):
     return base_url(url.lower()).encode('utf8')
Esempio n. 4
0
 def by_url_key(cls, url):
     b = base_url(url.lower())
     try:
         return b.encode('utf8')
     except UnicodeDecodeError:
         return str(b)
Esempio n. 5
0
File: link.py Progetto: cmak/reddit
 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]
Esempio n. 6
0
 def by_url_key(cls, url):
     return base_url(url.lower()).encode('utf8')
Esempio n. 7
0
 def old_by_url_key(url):
     prefix = 'byurl_'
     s = _force_utf8(base_url(url.lower()))
     return '%s%s' % (prefix, s)
Esempio n. 8
0
 def by_url_key(url, prefix=''):
     s = _force_utf8(base_url(url.lower()))
     return '%s%s' % (prefix, s)
Esempio n. 9
0
File: link.py Progetto: vin/reddit
 def by_url_key(cls, url):
     return str(base_url(url.lower()))
Esempio n. 10
0
 def old_by_url_key(url):
     prefix='byurl_'
     s = _force_utf8(base_url(url.lower()))
     return '%s%s' % (prefix, s)
Esempio n. 11
0
 def by_url_key(url, prefix=''):
     s = _force_utf8(base_url(url.lower()))
     return '%s%s' % (prefix, s)