storage: add ignore_errors and ignore_migration to the get_on_index methods

This commit is contained in:
Benjamin Dauvergne 2012-05-30 16:27:34 +02:00
parent a4fa88f127
commit 28111e8a57
1 changed files with 3 additions and 2 deletions

View File

@ -171,7 +171,7 @@ class StorableObject(object):
ignore_migration=ignore_migration)
get = classmethod(get)
def get_on_index(cls, id, index):
def get_on_index(cls, id, index, ignore_errors=False, ignore_migration=False):
if not cls._indexes:
raise KeyError()
objects_dir = cls.get_objects_dir()
@ -179,7 +179,8 @@ class StorableObject(object):
if not os.path.exists(index_dir):
cls.rebuild_indexes()
filename = os.path.join(index_dir, str(fix_key(id)))
return cls.get_filename(filename)
return cls.get_filename(filename, ignore_errors=ignore_errors,
ignore_migration=ignore_migration)
get_on_index = classmethod(get_on_index)
def get_ids_with_indexed_value(cls, index, value, auto_fallback=True):