Commit 957d0b4d authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

patches: drop zope.contenttype patch

This patch seems not needed
parent 81184b5f
...@@ -76,7 +76,6 @@ from Products.ERP5Type.patches import OFSHistory ...@@ -76,7 +76,6 @@ from Products.ERP5Type.patches import OFSHistory
from Products.ERP5Type.patches import OFSItem from Products.ERP5Type.patches import OFSItem
from Products.ERP5Type.patches import ExternalMethod from Products.ERP5Type.patches import ExternalMethod
from Products.ERP5Type.patches import User from Products.ERP5Type.patches import User
from Products.ERP5Type.patches import zopecontenttype
from Products.ERP5Type.patches import OFSImage from Products.ERP5Type.patches import OFSImage
from Products.ERP5Type.patches import _transaction from Products.ERP5Type.patches import _transaction
from Products.ERP5Type.patches import default_zpublisher_encoding from Products.ERP5Type.patches import default_zpublisher_encoding
......
from __future__ import print_function
# Monkey Patch the zope.contenttype to be able to detect svg image format.
try:
import zope.contenttype
original_text_type = zope.contenttype.text_type
def svg_fix_text_type(s):
s = s.strip()
if '<html>' not in s and "<svg" in s:
return 'image/svg+xml'
# If it is not an svg, just try original behaviour.
# This preserve the further improvements on zope.contenttype
# and preserve the fix.
return original_text_type(s)
# Overwrite original method with the SVG detection fix.
zope.contenttype.text_type = svg_fix_text_type
except ImportError:
print("Skip to patch zope.contenttype, because it is not present.")
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