src/hdalab/utils.py
changeset 492 19220d52bce7
parent 462 df8b3b49e81c
equal deleted inserted replaced
491:8444b4f67e45 492:19220d52bce7
     2 '''
     2 '''
     3 Created on Mar 13, 2012
     3 Created on Mar 13, 2012
     4 
     4 
     5 @author: ymh and tc
     5 @author: ymh and tc
     6 '''
     6 '''
       
     7 import hashlib
       
     8 import logging
       
     9 import re
       
    10 
     7 from django.core.cache import cache
    11 from django.core.cache import cache
     8 from django.utils.encoding import smart_str
    12 from django.utils.encoding import smart_str
     9 import hashlib
       
    10 import re
       
    11 
    13 
    12 import logging
    14 
    13 logger = logging.getLogger(__name__)
    15 logger = logging.getLogger(__name__)
    14 
    16 
    15 
    17 
    16 def fix_cache_key(key):
    18 def fix_cache_key(key):
    17     cache_key = re.sub(r'\s+', '-', key)
    19     cache_key = re.sub(r'\s+', '-', key)
    28     digits = []
    30     digits = []
    29     while n > 0:
    31     while n > 0:
    30         digits.insert(0, n % b)
    32         digits.insert(0, n % b)
    31         n  = n // b
    33         n  = n // b
    32     return digits
    34     return digits
       
    35 
       
    36     
       
    37