diff --git a/news/SUP-40979.bugfix b/news/SUP-40979.bugfix new file mode 100644 index 000000000..4c81c6e69 --- /dev/null +++ b/news/SUP-40979.bugfix @@ -0,0 +1,2 @@ +Fix sending zem document by mail +[jchandelle] \ No newline at end of file diff --git a/src/Products/urban/send_mail_action/adapter.py b/src/Products/urban/send_mail_action/adapter.py index 07442217d..e2cafc24d 100644 --- a/src/Products/urban/send_mail_action/adapter.py +++ b/src/Products/urban/send_mail_action/adapter.py @@ -13,4 +13,7 @@ @adapter(Interface, Interface, ISendMailAction) class GetDocumentToAttach(mail_with_attachment.GetDocumentToAttach): def __call__(self): - return [api.content.get(UID=file) for file in getattr(self.event, "files", [])] + return [ + api.content.get(path=file.encode("utf-8")) + for file in getattr(self.event, "files", []) + ] diff --git a/src/Products/urban/vocabularies.py b/src/Products/urban/vocabularies.py index 52354add3..31c687e9c 100644 --- a/src/Products/urban/vocabularies.py +++ b/src/Products/urban/vocabularies.py @@ -288,6 +288,9 @@ def __call__(self, context): class LicenceDocumentsVocabulary(object): implements(IVocabularyFactory) + def get_path(sefl, obj): + return "/".join(obj.getPhysicalPath()) + def __call__(self, context): contexts = get_licence_context(context, get_all_object=True) output = [] @@ -295,7 +298,7 @@ def __call__(self, context): return SimpleVocabulary(output) for context in contexts: docs = [ - SimpleTerm(doc.UID(), doc.UID(), doc.Title()) + SimpleTerm(self.get_path(doc), self.get_path(doc), doc.Title()) for doc in context.listFolderContents( contentFilter={ "portal_type": ["ATFile", "ATImage", "File", "Image"]