Commit 8cd7a917 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Zope 4.x: Fix OFS.Image PUT() for Python 2 (#1015).

This fixes failures in erp5_dms:testWebDavSupport.

  Traceback (innermost last):
    [...]
    Module Products.ERP5Type.patches.OFSImage, line 94, in PUT
      return PUT_orig(self, REQUEST, RESPONSE)
    Module OFS.Image, line 665, in PUT
      data = data.encode('UTF-8')
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 10: ordinal not in range(128)
parent 6545d235
Pipeline #19909 failed with stage
in 0 seconds
From 9a603533bacd9311ee634d8509c090037112b637 Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Fri, 25 Feb 2022 14:46:34 +0100
Subject: [PATCH] Fix PUT() for Python 2 (#1015).
---
src/OFS/Image.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/OFS/Image.py b/src/OFS/Image.py
index d81d2a0fa..c33ef68a5 100644
--- a/src/OFS/Image.py
+++ b/src/OFS/Image.py
@@ -661,7 +661,7 @@ class File(
file = REQUEST['BODYFILE']
data, size = self._read_data(file)
- if isinstance(data, str):
+ if isinstance(data, text_type):
data = data.encode('UTF-8')
content_type = self._get_content_type(file, data, self.__name__,
type or self.content_type)
--
2.35.1
...@@ -615,7 +615,9 @@ Acquisition-patch-options = -p1 ...@@ -615,7 +615,9 @@ Acquisition-patch-options = -p1
python-magic-patches = ${:_profile_base_location_}/../../component/egg-patch/python_magic/magic.patch#de0839bffac17801e39b60873a6c2068 python-magic-patches = ${:_profile_base_location_}/../../component/egg-patch/python_magic/magic.patch#de0839bffac17801e39b60873a6c2068
python-magic-patch-options = -p1 python-magic-patch-options = -p1
# Zope 4 patches # Zope 4 patches
Zope-patches = ${:_profile_base_location_}/../../component/egg-patch/Zope/0001-OFS-XMLExportImport.patch#12a9b9db76b3cd9035b6032d516143e0 Zope-patches =
${:_profile_base_location_}/../../component/egg-patch/Zope/0001-OFS-XMLExportImport.patch#12a9b9db76b3cd9035b6032d516143e0
${:_profile_base_location_}/../../component/egg-patch/Zope/0001-Fix-PUT-for-Python-2-1015.patch#e81c46a1de8916b05abc653209722c0b
Zope-patch-options = -p1 Zope-patch-options = -p1
[eggs-all-scripts] [eggs-all-scripts]
...@@ -669,7 +671,7 @@ pysvn = 1.9.15+SlapOSPatched001 ...@@ -669,7 +671,7 @@ pysvn = 1.9.15+SlapOSPatched001
python-ldap = 2.4.32+SlapOSPatched001 python-ldap = 2.4.32+SlapOSPatched001
python-magic = 0.4.12+SlapOSPatched001 python-magic = 0.4.12+SlapOSPatched001
PyPDF2 = 1.26.0+SlapOSPatched001 PyPDF2 = 1.26.0+SlapOSPatched001
Zope = 4.5.3+SlapOSPatched001 Zope = 4.5.3+SlapOSPatched002
## https://lab.nexedi.com/nexedi/slapos/merge_requests/648 ## https://lab.nexedi.com/nexedi/slapos/merge_requests/648
pylint = 1.4.4 pylint = 1.4.4
......
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