Re: ZODB writes on startup - why?
Martijn Faassen <[email protected]> Tue, 25 May 2004 15:58:22 +0200
| Newsgroups | gmane.comp.web.zope.formulator.devel |
|---|---|
| Message-ID | <[email protected]> |
Paul Winkler wrote: > 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? I'm not sure I am misunderstanding you here, even though BasicForm() is derived from persistent, they're attached to *classes* here, and since these classes aren't (and can't be) persistent I'd think these attributes never end up in the ZODB. Regards, Martjin