You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
472 B

11 years ago
from CodernityDB.hash_index import HashIndex
from hashlib import md5
class ProfileIndex(HashIndex):
def __init__(self, *args, **kwargs):
kwargs['key_format'] = '16s'
super(ProfileIndex, self).__init__(*args, **kwargs)
def make_key(self, key):
return md5(key).digest()
def make_key_value(self, data):
if data.get('type') == 'profile' and data.get('identifier'):
return md5(data.get('identifier')).digest(), None