I have a piece of code that I want to remove from my add-on for a Plone 4.3.15 site.
However, I have problems with that, the site simply stops working.
Here is the code:
...
class ISizeValuePair(Interface):
name = schema.TextLine(title=u"Nome", required=True)
largura = schema.Int(title=u"Largura", required=True)
altura = schema.Int(title=u"Altura",required=True)
class PersistentObject(PersistentField, schema.Object):
pass
class ISizeSettings(Interface):
tamanhos = schema.Tuple(
title=u'Tamanhos',
value_type=PersistentObject(ISizeValuePair,title=u"Tamanhos"),
required=False,
default=(),
missing_value=(),
)
class SizeValuePair(object):
implements(ISizeValuePair)
registerFactoryAdapter(ISizeValuePair, SizeValuePair)
I also register ISizeSettings in registry.xml, like this:
<?xml version="1.0"?>
<registry>
<records interface="ufal.profile.interfaces.ISizeSettings" />
</registry>
When I remove this code the following error is returned:
2018-11-12 09:20:47 ERROR ZODB.Connection Couldn't load state for 0x3f58
Traceback (most recent call last):
File "/home/alexandre/dev/plone4/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 860, in setstate
self._setstate(obj)
File "/home/alexandre/dev/plone4/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 914, in _setstate
self._reader.setGhostState(obj, p)
File "/home/alexandre/dev/plone4/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/serialize.py", line 612, in setGhostState
state = self.getState(pickle)
File "/home/alexandre/dev/plone4/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/serialize.py", line 605, in getState
return unpickler.load()
File "/usr/lib/python2.7/copy_reg.py", line 48, in _reconstructor
obj = object.__new__(cls)
TypeError: object.__new__(SizeValuePair) is not safe, use Persistence.Persistent.__new__()
I've already tried using wildcard.fixpersistentutilities and the instructions on this page to remove this problem, but I was not successful.
Does anyone know what the correct way to solve this problem?