Skip to content

Commit

Permalink
base-theme: added binary file: xml-iized import fails on initZMS
Browse files Browse the repository at this point in the history
  • Loading branch information
drfho committed Feb 12, 2025
1 parent bb08f97 commit 6b51812
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Products/zms/_xmllib.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,20 @@ def toCdata(self, s, xhtml=False):

# Return Text in CDATA.
elif s is not None:
if isinstance(s, bytes):
s = s.decode('utf-8')
# Hack for invalid characters
s = s.replace(chr(30), '')
# Hack for nested CDATA
s = re.compile(r'\<\!\[CDATA\[(.*?)\]\]\>').sub(r'<!{CDATA{\1}}>', s)
try:
if isinstance(s, bytes):
s = s.decode('utf-8')
# Hack for invalid characters
s = s.replace(chr(30), '')
# Hack for nested CDATA
s = re.compile(r'\<\!\[CDATA\[(.*?)\]\]\>').sub(r'<!{CDATA{\1}}>', s)
except:
# @zmsdev: If decoding fails, it just nests as CDATA
# toCdata() shall not and cannot be used to handle binary file data
# correctly in terms of creating a Zope file/image object
# Ref: ConfManager.getConfXmlFile() ==> standard.toXmlString(self, l)
standard.writeBlock(self, "[toCdata]: WARNING - Cannot create file/image object from binary data")
pass
# Wrap with CDATA
rtn = '<![CDATA[%s]]>'%s

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,21 @@ class Attrs:
,"name":"custom_zmsdemo.css"
,"repetitive":0
,"type":"File"}

theme_zms5_base_common_img_zmslogosvg = {"default":""
,"id":"theme_zms5_base/common/img/zmslogo.svg"
,"keys":[]
,"mandatory":0
,"multilang":0
,"name":"zmslogo.svg"
,"repetitive":0
,"type":"File"}

theme_zms5_base_common_img_faviconico = {"default":""
,"id":"theme_zms5_base/common/img/favicon.ico"
,"keys":[]
,"mandatory":0
,"multilang":0
,"name":"favicon.ico"
,"repetitive":0
,"type":"File"}

0 comments on commit 6b51812

Please sign in to comment.