def update_content(self, item: Content, new_label: str, new_content: str = None) -> Content: if item.label == new_label and item.description == new_content: # TODO - G.M - 20-03-2018 - Fix internatization for webdav access. # Internatization disabled in libcontent for now. raise SameValueError('The content did not changed') item.owner = self._user item.label = new_label item.description = new_content if new_content else item.description # TODO: convert urls into links item.revision_type = ActionDescription.EDITION return item
def create_comment(self, workspace: Workspace = None, parent: Content = None, content: str = '', do_save=False) -> Content: assert parent and parent.type != ContentType.Folder item = Content() item.owner = self._user item.parent = parent item.workspace = workspace item.type = ContentType.Comment item.description = content item.label = '' item.revision_type = ActionDescription.COMMENT if do_save: self.save(item, ActionDescription.COMMENT) return item