|
@@ -970,6 +970,7 @@ class File(DAVNonCollection):
|
970
|
970
|
parent = self.content.parent
|
971
|
971
|
|
972
|
972
|
with new_revision(self.content):
|
|
973
|
+ # Rename
|
973
|
974
|
if basename(destpath) != self.getDisplayName():
|
974
|
975
|
new_given_file_name = transform_to_bdd(basename(destpath))
|
975
|
976
|
new_file_name, new_file_extension = \
|
|
@@ -981,21 +982,24 @@ class File(DAVNonCollection):
|
981
|
982
|
)
|
982
|
983
|
self.content.file_extension = new_file_extension
|
983
|
984
|
self.content_api.save(self.content)
|
984
|
|
- else:
|
985
|
|
- workspace_api = WorkspaceApi(self.user)
|
986
|
|
- content_api = ContentApi(self.user)
|
987
|
|
-
|
988
|
|
- destination_workspace = self.provider.get_workspace_from_path(
|
989
|
|
- destpath,
|
990
|
|
- workspace_api,
|
991
|
|
- )
|
992
|
985
|
|
993
|
|
- destination_parent = self.provider.get_parent_from_path(
|
994
|
|
- destpath,
|
995
|
|
- content_api,
|
996
|
|
- destination_workspace,
|
997
|
|
- )
|
|
986
|
+ # Move
|
|
987
|
+ workspace_api = WorkspaceApi(self.user)
|
|
988
|
+ content_api = ContentApi(self.user)
|
998
|
989
|
|
|
990
|
+ destination_workspace = self.provider.get_workspace_from_path(
|
|
991
|
+ destpath,
|
|
992
|
+ workspace_api,
|
|
993
|
+ )
|
|
994
|
+ destination_parent = self.provider.get_parent_from_path(
|
|
995
|
+ destpath,
|
|
996
|
+ content_api,
|
|
997
|
+ destination_workspace,
|
|
998
|
+ )
|
|
999
|
+ if destination_parent == parent and destination_workspace == workspace: # nopep8
|
|
1000
|
+ # Do not move to same place
|
|
1001
|
+ pass
|
|
1002
|
+ else:
|
999
|
1003
|
self.content_api.move(
|
1000
|
1004
|
item=self.content,
|
1001
|
1005
|
new_parent=destination_parent,
|