Commit 5b3f99e2 authored by Jim Fulton's avatar Jim Fulton

Support storages without any undo methods.

parent c7ff478a
...@@ -41,7 +41,7 @@ class BlobStorage(SpecificationDecoratorBase): ...@@ -41,7 +41,7 @@ class BlobStorage(SpecificationDecoratorBase):
# Proxies can't have a __dict__ so specifying __slots__ here allows # Proxies can't have a __dict__ so specifying __slots__ here allows
# us to have instance attributes explicitly on the proxy. # us to have instance attributes explicitly on the proxy.
__slots__ = ('fshelper', 'dirty_oids') __slots__ = ('fshelper', 'dirty_oids', '_BlobStorage__supportsUndo')
def __new__(self, base_directory, storage): def __new__(self, base_directory, storage):
return SpecificationDecoratorBase.__new__(self, storage) return SpecificationDecoratorBase.__new__(self, storage)
...@@ -53,6 +53,13 @@ class BlobStorage(SpecificationDecoratorBase): ...@@ -53,6 +53,13 @@ class BlobStorage(SpecificationDecoratorBase):
self.fshelper.create() self.fshelper.create()
self.fshelper.checkSecure() self.fshelper.checkSecure()
self.dirty_oids = [] self.dirty_oids = []
try:
supportsUndo = storage.supportsUndo
except AttributeError:
supportsUndo = False
else:
supportsUndo = supportsUndo()
self.__supportsUndo = supportsUndo
@non_overridable @non_overridable
def __repr__(self): def __repr__(self):
...@@ -184,7 +191,7 @@ class BlobStorage(SpecificationDecoratorBase): ...@@ -184,7 +191,7 @@ class BlobStorage(SpecificationDecoratorBase):
# perform a pack on blob data # perform a pack on blob data
self._lock_acquire() self._lock_acquire()
try: try:
if unproxied.supportsUndo(): if self.__supportsUndo:
self._packUndoing(packtime, referencesf) self._packUndoing(packtime, referencesf)
else: else:
self._packNonUndoing(packtime, referencesf) self._packNonUndoing(packtime, referencesf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment