Exemplo n.º 1
0
 def get_absolute_url(self):
     return (
         'email:go',
         (),
         {
             'pk_in_base62': base62.encode(self.pk, ),
         },
     )
Exemplo n.º 2
0
def uniq_hash(s):
    """
    Create a short hash from a given string.
    Be warned, this function is a liar: it's not really a hash as it's CRC-based,
    and as such it has a high collision potential!
    """
    if not isinstance(s, bytes):
        s = s.encode('utf-8')
    crc = crc32(s)
    return base62.encode(crc)
Exemplo n.º 3
0
 def url(self):
     current_site = Site.objects.get_current()
     return "http://{0}/{1}/".format(current_site.domain, base62.encode(self.pk))
Exemplo n.º 4
0
 def get_absolute_url(self):
     return ('email:go',
             (),
             {'pk_in_base62': base62.encode(self.pk, ), }, )
Exemplo n.º 5
0
 def url(self):
     current_site = Site.objects.get_current()
     return "http://{0}/{1}/".format(current_site.domain,
                                     base62.encode(self.pk))
Exemplo n.º 6
0
def mkrandstr():
    return (base62.encode(int(time.time())) +
            base62.encode(random.randint(0, 61)))