added index package for multikey dictionaries

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@1512 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2006-11-21 20:03:14 +00:00
parent 63b9a45624
commit 76193d0de0
2 changed files with 4 additions and 3 deletions

View file

@ -62,5 +62,5 @@ Index entries that are present in the stored dictionaries must always match:
>>> registry[('edit.html', None, None, 'Custom')] = 'edit.html for Custom skin'
>>> registry.get(('edit.html', 'task', 'bugfixes', '')) is None
>>> registry.get(('edit.html', 'task', 'bugfixes')) is None
True

View file

@ -68,8 +68,9 @@ class MultiKeyDict(dict):
for r in rList:
skip = False
for nx, kx in enumerate(r[0]):
if kx and kx != key[nx]: # if stored key elements are present
skip = True # they must match
# if stored key elements are present they must match
if kx and (len(key) <= nx or kx != key[nx]):
skip = True
break
if skip:
continue