Plone: ​​TypeError: cannot sort objects in wrappers

I use / fix collective.logbook to save errors on the site. Currently, the logbook does not work on my site with a few exceptions:

  File "/srv/plone/xxx/src/collective.logbook/collective/logbook/events.py", line 101, in hand transaction.commit() File "/srv/plone/buildout-cache/eggs/transaction-1.1.1-py2.6.egg/transaction/_manager.py", line 8 return self.get().commit() File "/srv/plone/buildout-cache/eggs/transaction-1.1.1-py2.6.egg/transaction/_transaction.py", li self._commitResources() File "/srv/plone/buildout-cache/eggs/transaction-1.1.1-py2.6.egg/transaction/_transaction.py", li rm.commit(self) File "/srv/plone/buildout-cache/eggs/ZODB3-3.10.5-py2.6-linux-x86_64.egg/ZODB/Connection.py", lin self._commit(transaction) File "/srv/plone/buildout-cache/eggs/ZODB3-3.10.5-py2.6-linux-x86_64.egg/ZODB/Connection.py", lin self._store_objects(ObjectWriter(obj), transaction) File "/srv/plone/buildout-cache/eggs/ZODB3-3.10.5-py2.6-linux-x86_64.egg/ZODB/Connection.py", lin p = writer.serialize(obj) # This calls __getstate__ of obj File "/srv/plone/buildout-cache/eggs/ZODB3-3.10.5-py2.6-linux-x86_64.egg/ZODB/serialize.py", line return self._dump(meta, obj.__getstate__()) File "/srv/plone/buildout-cache/eggs/ZODB3-3.10.5-py2.6-linux-x86_64.egg/ZODB/serialize.py", line self._p.dump(state) TypeError: Can't pickle objects in acquisition wrappers. 

This is obviously because the log is trying to write an error record that relates to the acquired object. I assume the solution is to clear the error from such objects.

However, how can I find out what a bad object is, how it ends with a transaction manager, and what are the references to Python objects causing this problem? Or anything that could help me debug this problem?

+4
source share
1 answer

If you can reliably reproduce this, you can put the print expression or pdb.set_trace() in the ZODB _register connection method (in ZODB/connection.py inside the ZODB egg):

 def _register(self, obj=None): # ... skipped lines ... if obj is not None: self._registered_objects.append(obj) # Insert print statement here. 

Now, when any object has been marked as modified or added to the connection as a new object, it will be printed on the console. This should help you in the debugging process. Good luck

+3
source

Source: https://habr.com/ru/post/1433540/


All Articles