ZODB writes on startup - why?

Paul Winkler <[email protected]> Fri, 21 May 2004 16:32:14 -0400
Newsgroups gmane.comp.web.zope.formulator.devel
Message-ID <[email protected]>
Howdy,

Over on zope-dev I've been trying to get a Zope 2.7.0 instance to
start with a read-only storage. Zope fails during product
initialization *only* if I've got Formulator installed.

I've traced this to FieldRegistry.initializeFieldForm().
I've never looked at the Formulator code before today,
so I'm probably misunderstanding all kinds of things...
but my first question is about these lines:

def initializeFieldForm(field_class):
    """Initialize the properties (fields and values) on a particular
    field class. Also add the tales and override methods.
    """
    ...
    form = BasicForm()
    override_form = BasicForm()
    tales_form = BasicForm()
    ...
    field_class.form = form
    field_class.override_form = override_form
    field_class.tales_form = tales_form

BasicForm inherits from Persistent.
I think this is my problem.  initializeFieldForm()
gets called many times during product initialization,
because it's called by FieldRegistry.FieldRegistry.registerField.

Knowing only this much, I don't understand why form, override_form,
and tales_form need to be persistent. Do they ever change
after startup?  AFAICT, they get recreated every time you restart zope! 
Isn't that just pointless ZODB bloat?  

If BasicForm needs to derive from Persistent for some other reason,
might it be possible to refactor a bit and use a non-persistent
relative of BasicForm for field_class.form, et al?


-- 

Paul Winkler
http://www.slinkp.com