[Zope-dev] ZPatterns.. Property sheets... once and for all. ;-)
Steve Spicklemire
steve@spvi.com
Thu, 24 Aug 2000 12:35:01 -0500 (EST)
Hi Folks,
OK.. I didn't hear much from my last plea for advice... I
thought perhaps such a concrete problem would product lots
of sage advice... but there's good news: here's another chance!
Really Really Basic:
If I have a class like so:
class Shopper(
OFS.SimpleItem.Item,
ZPatterns.DataSkins.DataSkin,
Acquisition.Implicit,
AccessControl.Role.RoleManager,
):
""" A Shopper """
# Specify a name for the item type:
meta_type='Shopper'
and let's say I define some attributes in the class....
id = 'default'
email = ''
_passwd = ''
Now... let's further say that I want a developer using this class to
be able to add propertysheets to instances of this class after I'm
finished... to make customized versions of these
objects. Also.. perhaps I want to take advantage of the 'automatic'
nature of property sheets to provide a usable interface so that users
can edit various properties. I was successful in adding a propertysheet
using the
/specialist/anobject/propertysheets/manage_addPropertySheet?id=foo&ns=
technique.. which I'm pretty sure I could also implement
programattically. ;-). But when I try:
/specialist/anobject/propertysheets/foo/manage
I get an attribute error looking for 'a_'.
I get the same error when I try:
/specialist/anobject/propertysheets/foo/manage_addProperty?id=blah&value=hh&type=string
Any idea what's up with that?
But no matter... I can't add 'email' to *any* propertysheet, even those
in the ZClass, since it's already used in the class. So do I leave it out
of the class and "hope" that someone defines it in some propertysheet
somewhere? Do I do lots of:
if hassattr(self, 'email') and so on.. in case somehow it didn't get taken
care of? I *know* I missing something deep. I'm sure I'll say something
dumb enough here soon.. and someone will point out my basic misunderstanding. ;-)
thanks!
-steve