[Zope] cannot change property of type lines permanently

Geir Bækholt lists at elvix.com
Fri Jan 16 15:36:59 EST 2004


On  Fri, 16 Jan 2004 18:33:25 +0100 GMT 
Marcus Bergmann asked the Zope mailinglist about the following:
  
> I'm trying this:

> <dtml-call "calendar.mailaddresses.remove(REQUEST.mailaddress)">

> where 'calendar' is a folder, 'mailaddresses' is a property of it (type
> is lines) and 'mailaddress' is a variable the DTML method received via
> an HTML form.

> After the request, the removed line entry seems to be gone. It's not
> shown in the ZMI or in my HTML site which shows me the mailaddresses.
> But if I restart Zope the removed line is there again.
> Also if I copy the folder, then the copy shows me the removed entry in
> its properties.

This is an issue with how persistence works. If you just change a
mutable attribute, the ZODB does not know to update the object.

something like this might work:

tempaddresses = calendar.mailaddresses[:]
tempaddresses.remove(REQUEST.mailaddress)
calendar.mailaddresses = tempaddresses

actually assigning a value to the property, not just changing it,
should make Zope aware of the change.

:)

-- 
__________________________________________________________________

 Geir Bækholt    ·   Interaction Architect   ·    Plone Solutions

 Development · Training · Support · http://www.plonesolutions.com
__________________________________________________________________






More information about the Zope mailing list