[Zope] Too early initialization of property sheets?
John R. Daily
jdaily@progeny.com
Tue, 27 Mar 2001 16:18:12 -0500
Under Zope 2.3.0, with ZClasses I'm defining within Zope:
I have a method defined in a base class to loop through all property
sheets in the newly-created object and capture properties which are
stored in the REQUEST object. I invoke it during the
manage_add<product> method for inheriting classes. An example:
---
# Defined on behalf of class Foo
def manage_addFoo(id, title=""):
foo = context.Foo.createInObjectManager(id, context.REQUEST)
foo.private_init_defaults()
foo.request_set_properties(context.REQUEST)
---
# Defined in inherited class VirtualFoo
def request_set_properties(REQUEST):
sheets = container.propertysheets
for sheet in sheets.values():
for prop in sheet.propertyIds():
if REQUEST.has_key(prop):
sheet.manage_changeProperties({prop:REQUEST[prop]})
---
Unfortunately, the sheets at this point in time seem to be immutable.
I get errors which look as if property_extensible_schema__() is
returning 0.
The properties can be modified through the administrative interface
after initialization, so I'm confident that I'm not somehow
accidentally inheriting FixedSchema.
In an earlier version of this product I invoked
foo.propertysheets.default.manage_editProperties(context.REQUEST) at
the same point in manage_addFoo, but in this case I want to make
certain that all inherited property sheets are handled in an automated
fashion.
Am I approaching this in the wrong manner?
-- --
John R. Daily jdaily@progeny.com
Systems Programmer Progeny Linux Systems
Master of the ephemeral epiphany