objectstore: get returns object not path
Change objectstore.get to return an object or None instead of a path.
This commit is contained in:
parent
d6eb78df58
commit
35fa429965
1 changed files with 5 additions and 5 deletions
|
|
@ -264,12 +264,12 @@ class ObjectStore(contextlib.AbstractContextManager):
|
|||
prefix=prefix,
|
||||
suffix=suffix)
|
||||
|
||||
@contextlib.contextmanager
|
||||
def get(self, object_id):
|
||||
with Object(self) as obj:
|
||||
obj.base = object_id
|
||||
with obj.read() as path:
|
||||
yield path
|
||||
if not self.contains(object_id):
|
||||
return None
|
||||
|
||||
obj = self.new(base_id=object_id)
|
||||
return obj
|
||||
|
||||
def new(self, base_id=None):
|
||||
"""Creates a new temporary `Object`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue