[ZODB-Dev] reasons to use ZODB

Christian Robottom Reis kiko at async.com.br
Mon Mar 1 18:07:02 EST 2004


On Mon, Mar 01, 2004 at 05:36:18PM -0500, Duncan McGreggor wrote:
> If you'd like to take a look at it, it's about half-way done (still 
> have to do the 'tools' section, backups, and ZEO):
> http://zope.org/Members/adytumsolutions/HowToLoveZODB_PartI

As per:
http://zope.org/Members/adytumsolutions/HowToLoveZODB_PartII/HowToLoveZODB_PartIII

    If we hadn't based our schema on the Persistent class, we would need to
    add an extra line of code:

      >>> get_transaction().commit()

    which would write the data to the database by using the commit
    command. However, since we did use Persistent, commits are done
    automatically for us.

Either I'm confused by the text, or this is incorrect (or both!) :-)
Regardless of inheriting from Persistent, commit()s are not done
automatically in the ZODB -- they need to be done explicitly. The main
difference inheriting from Persistent gives you is what we've been
discussing today on the mailing list -- non-Persistent objects need to
persist their state by attaching themselves to a Persistent objects, and
changes done to them are not automatically "communicated" to the
relevant transaction (you need to set _p_changed in whoever you attached
them to).

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331



More information about the ZODB-Dev mailing list