[BlueBream] [Zope-dev] Reg. persisting data in ZODB via forms

Tres Seaver tseaver at palladion.com
Thu Jun 9 09:51:42 EDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/09/2011 06:58 AM, Laurence Rowe wrote:

>> > I am not aware of the zcml configuration that can mark a class as
>> > persistent. If you could explain, it would be helpful.
> ZCML is not relevant here.

Correct.  There is no such ZCML directive.  In a ZODB application, all
your "model" classes normally derive from Persistent.

> Deriving your class from Persistent is normally the right choice.
> Storing immutable non-persistent objects such as strings, ints, floats
> or tuples of them also works without surprises. Storing mutable
> non-persistent objects in the ZODB is considered advanced usage and
> you must inform the persistence machinery on any modification. The
> best way to do this is to re-assign the non-persistent object to it's
> parent persistent object, causing the parent to be marked as modified.

FTR, you can also set the parent object's '_p_changed' attribute to a
true value.


Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3wz+4ACgkQ+gerLs4ltQ565wCgu7vCM5TihUGsFhhoOYnLkiXK
2c8AoNpLdwn1Sj0m2CWtd9f7l2u1m4Yv
=sG2s
-----END PGP SIGNATURE-----



More information about the bluebream mailing list