More nosql

This commit is contained in:
Ruud
2014-02-02 20:41:14 +01:00
parent 63743dd2b6
commit 99252074be
82 changed files with 643 additions and 715 deletions
+6 -7
View File
@@ -1,16 +1,15 @@
from CodernityDB.hash_index import HashIndex
from hashlib import md5
from CodernityDB.tree_index import TreeBasedIndex
class ProfileIndex(HashIndex):
class ProfileIndex(TreeBasedIndex):
def __init__(self, *args, **kwargs):
kwargs['key_format'] = '16s'
kwargs['key_format'] = 'i'
super(ProfileIndex, self).__init__(*args, **kwargs)
def make_key(self, key):
return md5(key).digest()
return key
def make_key_value(self, data):
if data.get('type') == 'profile' and data.get('identifier'):
return md5(data.get('identifier')).digest(), None
if data.get('_t') == 'profile':
return data.get('order', 99), None