def get_storage_by_id(self, storage_id): """!TXT! Return the specified Storage, raise KeyError otherwise.""" storage = self._getOb(storage_id) if IStoragePluginBase.providedBy(storage): return storage raise KeyError('!TXT! Storage "%s" not found.' % storage_id)
def storage_items(self): """!TXT! Return tuples of id, value of Storages""" result = [] for id, object in self.objectItems(): if IStoragePluginBase.providedBy(object): result.append((id, object)) return result
def get_storage(self, source): """!TXT! Return the specified Storage. Source is either a Storage's id, a Storage or an EntrySet. Raises KeyError if no Storage can be returned.""" if IStoragePluginBase.providedBy(source) or IEntrySet.providedBy(source): return source return self.get_storage_by_id(source)