diff --git a/loops/patch.py b/loops/patch.py new file mode 100644 index 0000000..d50e7d5 --- /dev/null +++ b/loops/patch.py @@ -0,0 +1,19 @@ +# loops.patch + +# monkey patches, activate with: +# in some .zcml file, e.g. application.zcml + +import zope.index.text.widcode +from zope.index.text.widcode import _prog, _decode, _decoding + +def patched_decode(code): + """_prog pattern is now a string, but after updating from Python2 + code is still a bytes array.""" + get = _decoding.get + if isinstance(code, bytes): + # byte-wise conversion to str: + code = ''.join(chr(b) for b in code) + return [get(p) or _decode(p) for p in _prog.findall(code)] + +zope.index.text.widcode.decode = patched_decode +print("loops.patch: monkey patch for 'zope.index.text.widcode.decode()' installed.") diff --git a/pyproject.toml b/pyproject.toml index ada7a00..bd6594f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ dependencies = [ "zope.pluggableauth", "zope.principalannotation", "zope.principalregistry", - "zope.publisher", + "zope.publisher==5.2.1", "zope.securitypolicy", "zope.site", "zope.thread",