That works great, thank you Thierry

Thierry Florac wrote:
Le mardi 15 janvier 2008 à 07:05 -0500, john saponara a écrit :
I add a Limoservice object, then inside that object add a Car; then I add a Driver (which contains a Car), and the AddForm offers a dropdown with '(no value)' and my Car object. If I select the car from the dropdown I get an error:

UnpickleableError: Cannot pickle <type ''> objects

Whereas if I leave the dropdown at '(no value)', the error does not occur. What am I doing wrong? (See attached error.txt for full error.)

Hi, As explained into error message, you can't store security proxied
objects into ZODB : you have to remove proxy before they can be stored.

What I generally do is just something like this :

  from import removeSecurityProxy

  class Driver(Contained):
    _car = None

    def _getCar(self):
      return self._car

    def _setCar(self, value):
      self._car = removeSecurityProxy(value)

    car = property(_getCar,_setCar)

Like that, any way the car property is modified, it's automatically
unproxied and can be stored safely.

  Thierry Florac

Zope3-users mailing list

Reply via email to