Plone:TypeError:无法在采集包装器中pickle对象

时间:2012-09-11 09:05:36

标签: plone zope

我正在使用/ fix collective.logbook来保存网站上的错误。目前日志在我的网站上失败,但有一些例外情况:

  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.

这显然是因为日志试图写入引用获取对象的错误记录。我假设解决方案是清除这些对象的错误。

但是,我怎样才能弄清楚什么是坏对象,它如何结束事务管理器以及导致此问题的Python对象引用是什么?或者任何可以帮我调试这个问题的东西?

1 个答案:

答案 0 :(得分:3)

如果您可以可靠地重现这一点,您可以在ZODB连接pdb.set_trace()方法(_register鸡蛋内的ZODB/connection.py)中输入打印语句或ZODB

def _register(self, obj=None):
    # ... skipped lines ...

    if obj is not None:
        self._registered_objects.append(obj)
        # Insert print statement here.

现在,只要任何对象被标记为已更改或作为新对象添加到连接,它就会被打印到控制台。这应该可以帮助您完成调试过程。祝你好运!