utils.py
branchtls-sprint
changeset 1180 5536d4ee2bc3
parent 1134 f885df228fc0
child 1387 4af48b1aaf29
equal deleted inserted replaced
1179:70825477c6ce 1180:5536d4ee2bc3
    51     
    51     
    52     encoding is guessed by locale.getpreferredencoding()
    52     encoding is guessed by locale.getpreferredencoding()
    53     """
    53     """
    54     # date format may depend on the locale
    54     # date format may depend on the locale
    55     encoding = locale.getpreferredencoding(do_setlocale=False) or 'UTF-8'
    55     encoding = locale.getpreferredencoding(do_setlocale=False) or 'UTF-8'
    56     return unicode(date.strftime(fmt), encoding)
    56     return unicode(date.strftime(str(fmt)), encoding)
    57 
    57 
    58 def make_uid(key):
    58 def make_uid(key):
    59     """forge a unique identifier"""
    59     """forge a unique identifier"""
    60     msg = str(key) + "%.10f"%time() + str(randint(0, 1000000))
    60     msg = str(key) + "%.10f"%time() + str(randint(0, 1000000))
    61     return md5(msg).hexdigest()
    61     return md5(msg).hexdigest()