Commit 1db3034a authored by Titouan Soulard's avatar Titouan Soulard

erp5_corporate_identity: stop using `html_quotes` for books metadata

As reported on the forum, using this function displays some weird characters
when exporting, such as `&#33`. This is due to a double-escape, first by the
`WebPage_viewAsBook` script, and second by Page Template without `structure`
option.

/cc @xiaowu.zhang
/reviewed-by @jerome @Nicolas
/reviewed-on !2023
parent 172e60df
...@@ -35,7 +35,6 @@ MAIN FILE: generate book in different output formats ...@@ -35,7 +35,6 @@ MAIN FILE: generate book in different output formats
import re import re
import six import six
from Products.PythonScripts.standard import html_quote
from Products.ERP5Type.Utils import str2bytes, bytes2str, unicode2str from Products.ERP5Type.Utils import str2bytes, bytes2str, unicode2str
from base64 import b64encode from base64 import b64encode
...@@ -79,11 +78,11 @@ book_modification_date = book.getModificationDate() ...@@ -79,11 +78,11 @@ book_modification_date = book.getModificationDate()
book_language = book.getLanguage() book_language = book.getLanguage()
# XXX sigh for passing "" around # XXX sigh for passing "" around
book_reference = html_quote(override_document_reference) if override_document_reference else book.getReference() book_reference = override_document_reference if override_document_reference else book.getReference()
book_short_title = html_quote(override_document_short_title) if override_document_short_title else book.getShortTitle() book_short_title = override_document_short_title if override_document_short_title else book.getShortTitle()
book_version = html_quote(override_document_version) if override_document_version else book.getVersion() or "001" book_version = override_document_version if override_document_version else book.getVersion() or "001"
book_description = html_quote(override_document_description) if override_document_description else book.getDescription() book_description = override_document_description if override_document_description else book.getDescription()
book_title = html_quote(override_document_title) if override_document_title else book.getTitle() book_title = override_document_title if override_document_title else book.getTitle()
if six.PY2 and isinstance(book_content, six.text_type): if six.PY2 and isinstance(book_content, six.text_type):
book_content = unicode2str(book_content) book_content = unicode2str(book_content)
...@@ -99,7 +98,7 @@ if override_batch_mode: ...@@ -99,7 +98,7 @@ if override_batch_mode:
book_revision = "1" book_revision = "1"
book_short_date = book_modification_date.strftime('%Y-%m-%d') book_short_date = book_modification_date.strftime('%Y-%m-%d')
if book_language: if book_language and 'AcceptLanguage' in book.REQUEST:
book.REQUEST['AcceptLanguage'].set(book_language, 10) book.REQUEST['AcceptLanguage'].set(book_language, 10)
else: else:
book_language = blank book_language = blank
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment