zopefoundation / Products.ExternalEditor

Other
2 stars 6 forks source link

TypeError: 'Acquisition.ImplicitAcquisitionWrapper' object is not an iterator #24

Closed openlegis-br closed 1 month ago

openlegis-br commented 1 month ago

2024-08-19 12:03:19,269 ERROR [waitress:435][waitress-0] Exception while serving /sagl/cadastros/materia/sapl_documentos/materiaodt/externalEdit/72109_texto_integral.odt.zem Traceback (most recent call last): File "/var/openlegis/SAGL5/eggs/waitress-2.1.2-py3.10.egg/waitress/channel.py", line 428, in service task.service() File "/var/openlegis/SAGL5/eggs/waitress-2.1.2-py3.10.egg/waitress/task.py", line 168, in service self.execute() File "/var/openlegis/SAGL5/eggs/waitress-2.1.2-py3.10.egg/waitress/task.py", line 434, in execute app_iter = self.channel.server.application(environ, start_response) File "/var/openlegis/SAGL5/eggs/Paste-3.7.1-py3.10.egg/paste/translogger.py", line 77, in call return self.application(environ, replacement_start_response) File "/var/openlegis/SAGL5/eggs/Zope-5.10-py3.10.egg/ZPublisher/httpexceptions.py", line 30, in call return self.application(environ, start_response) File "/var/openlegis/SAGL5/eggs/Zope-5.10-py3.10.egg/ZPublisher/WSGIPublisher.py", line 391, in publish_module response = _publish(request, new_mod_info) File "/var/openlegis/SAGL5/eggs/Zope-5.10-py3.10.egg/ZPublisher/WSGIPublisher.py", line 285, in publish result = mapply(obj, File "/var/openlegis/SAGL5/eggs/Zope-5.10-py3.10.egg/ZPublisher/mapply.py", line 98, in mapply return debug(object, args, context) File "/var/openlegis/SAGL5/eggs/Zope-5.10-py3.10.egg/ZPublisher/WSGIPublisher.py", line 68, in call_object return obj(*args) File "/var/openlegis/SAGL5/eggs/Products.ExternalEditor-4.0-py3.10.egg/Products/ExternalEditor/ExternalEditor.py", line 224, in index_html for data in body: File "/var/openlegis/SAGL5/eggs/Products.ExternalEditor-4.0-py3.10.egg/Products/ExternalEditor/ExternalEditor.py", line 52, in next self.data = next(self.data) TypeError: 'Acquisition.ImplicitAcquisitionWrapper' object is not an iterator

What version of Python and Zope/Addons I am using: Python 3.10 Zope 5.10

d-maurer commented 1 month ago

OpenLegis wrote at 2024-9-14 07:47 -0700:

2024-08-19 12:03:19,269 ERROR [waitress:435][waitress-0] Exception while serving /sagl/cadastros/materia/sapl_documentos/materiaodt/externalEdit/72109_texto_integral.odt.zem Traceback (most recent call last): ... return obj(*args) File "/var/openlegis/SAGL5/eggs/Products.ExternalEditor-4.0-py3.10.egg/Products/ExternalEditor/ExternalEditor.py", line 224, in index_html for data in body: File "/var/openlegis/SAGL5/eggs/Products.ExternalEditor-4.0-py3.10.egg/Products/ExternalEditor/ExternalEditor.py", line 52, in next self.data = next(self.data) TypeError: 'Acquisition.ImplicitAcquisitionWrapper' object is not an iterator

What version of Python and Zope/Addons I am using:

I do not think this is an Acquisition problem: Acquisition wrappers try to behave like the wrapped object; i.e. they expose a __next__ method if and only if the wrapped object does. In your case, the wrapped object apparently does not have a __next__ method and then the Acquition behavior is exactly as it should be.

openlegis-br commented 1 month ago

The solution that worked for me was to change line 52 of the ExternalEditor.py file, from: self.data = next(self.data) to: self.data = self.data.next

icemac commented 1 month ago

Moving the issue to Products.ExternalEditor, where it seems to belong to. @openlegis-br Could you come up with a pull request for the fix?

davisagli commented 1 month ago

@icemac This is a duplicate of #23, but the actual bug seems to be in Zope.

d-maurer commented 1 month ago

David Glick wrote at 2024-9-16 07:45 -0700:

@icemac This is a duplicate of #23, but the actual bug seems to be in Zope.

I thought this as well but I have been wrong.

@openlegis-br is working on a fix in "https://github.com/zopefoundation/Products.ExternalEditor/pull/25"

davisagli commented 1 month ago

@d-maurer Oh right, it's an incompatibility between Pdata and ExternalEditor, and I agree it makes more sense to fix it in ExternalEditor.