|
@@ -866,7 +866,7 @@ class ContentApi(object):
|
866
|
866
|
new_parent: Content=None,
|
867
|
867
|
new_label: str=None,
|
868
|
868
|
do_notify: bool=True,
|
869
|
|
- ) -> None:
|
|
869
|
+ ) -> Content:
|
870
|
870
|
if (not new_parent and not new_label) or (new_parent == item.parent and new_label == item.label): # nopep8
|
871
|
871
|
# TODO - G.M - 08-03-2018 - Use something else than value error
|
872
|
872
|
raise ValueError("You can't copy file into itself")
|
|
@@ -897,11 +897,6 @@ class ContentApi(object):
|
897
|
897
|
content.revisions.append(cpy_rev)
|
898
|
898
|
DBSession.add(content)
|
899
|
899
|
|
900
|
|
- # TODO - G.M - 15-03-2018 - Child copy broken !
|
901
|
|
- # INFO - G.M - 15-03-2018 - copy childrens (comments and others things)
|
902
|
|
- # for child in item.children:
|
903
|
|
- # self.copy(child, content)
|
904
|
|
-
|
905
|
900
|
# INFO - GM - 15-03-2018 - add "copy" revision
|
906
|
901
|
content.new_revision()
|
907
|
902
|
content.parent = parent
|
|
@@ -914,6 +909,11 @@ class ContentApi(object):
|
914
|
909
|
}
|
915
|
910
|
DBSession.add(content)
|
916
|
911
|
self.save(content, ActionDescription.COPY, do_notify=do_notify)
|
|
912
|
+ return content
|
|
913
|
+
|
|
914
|
+ def copy_children(self, origin_content:Content, new_content: Content):
|
|
915
|
+ for child in origin_content.children:
|
|
916
|
+ self.copy(child, new_content)
|
917
|
917
|
|
918
|
918
|
def move_recursively(self, item: Content,
|
919
|
919
|
new_parent: Content, new_workspace: Workspace):
|