move: catch OSerror
This commit is contained in:
@@ -35,10 +35,12 @@ class StoragePartMove(StorageBase):
|
|||||||
assert isinstance(to_collection, multifilesystem.Collection)
|
assert isinstance(to_collection, multifilesystem.Collection)
|
||||||
assert isinstance(item.collection, multifilesystem.Collection)
|
assert isinstance(item.collection, multifilesystem.Collection)
|
||||||
assert item.href
|
assert item.href
|
||||||
os.replace(pathutils.path_to_filesystem(
|
move_from = pathutils.path_to_filesystem(item.collection._filesystem_path, item.href)
|
||||||
item.collection._filesystem_path, item.href),
|
move_to = pathutils.path_to_filesystem(to_collection._filesystem_path, to_href)
|
||||||
pathutils.path_to_filesystem(
|
try:
|
||||||
to_collection._filesystem_path, to_href))
|
os.replace(move_from, move_to)
|
||||||
|
except OSError as e:
|
||||||
|
raise ValueError("Failed to move file %r => %r %s" % (move_from, move_to, e)) from e
|
||||||
self._sync_directory(to_collection._filesystem_path)
|
self._sync_directory(to_collection._filesystem_path)
|
||||||
if item.collection._filesystem_path != to_collection._filesystem_path:
|
if item.collection._filesystem_path != to_collection._filesystem_path:
|
||||||
self._sync_directory(item.collection._filesystem_path)
|
self._sync_directory(item.collection._filesystem_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user