[Zope] setting up a ZClass - base class of PropertyManager? plus weird gradual broken product messages
A M Thomas
am@virtueofthesmall.com
Mon, 22 Apr 2002 22:39:16 -0400
Thanks, Steve,
I prefer PropertyManager to property sheets at the moment for a couple
of reasons: 1) I don't have to "group" my properties, I don't have to
remember what property is in what sheet, I don't have to use quite so
long a command to update the properties, and 2) If I create an instance
of a ZClass with a propertysheet, it seems to always define the
properties, and I want to inherit them from a parent object unless I
specifically define them in the new object. I may be missing something,
but I seemed to get this effect, and that's why I switched to using
PropertyManager.
I understand why one would be nervous about ZClasses. It is a pain not
to be able to change base classes easily! Deleting instances and
starting over will probably not be an option in the future, though, as
my product will be used in some live sites, but I may still have to make
significant changes.
Thanks hugely for the response!
Am
Steve Spicklemire wrote:
>
> Hi Am,
>
> ZClasses have "propertsheets" already.. so you shouldn't really need to
> inherit from PropertyManager. Also.. changing ZClasses by deleting and
> recreating is a sort of "last ditch" scenario and likely to cause
> problems. You're probably better off deleting all your old instances and
> starting over. This is one of the "major problems" with ZClasses that
> makes so many developers nervous about them. Having said all that, I
> still find them useful in conjunction with a product like ZPatterns that
> permits you to keep the actual data/relations in SQL or LDAP or whatever.
>
> -steve
>
> On Saturday, April 20, 2002, at 03:52 PM, A M Thomas wrote:
>
> > Hello there, and thank you very much in advance for any help.
> >
> > I'm working on my Zope (2.5.0) product through the management interface,
> > and realized that if I just created a ZClass with base classes of
> > ObjectManager and CatalogAware, I couldn't add properties to it :( So,
> > I went to re-create my ZClass - and discovered that PropertyManager
> > isn't in the list of selectable base classes. Why is this? Is there
> > some way I can inherit directly from PropertyManager?
> >
> > I went ahead and created it with an additional base class of
> > DTMLDocument, since it's got PropertyManager as one of its base classes,
> > but this isn't what I really want -- in addition to being slightly
> > inelegant, now the manage_findForm method doesn't appear in the
> > available methods for creating Views.
> >
> > Must I create my product in Python only to get PropertyManager cleanly?
> > Would this even work? And would converting be easy?
> >
> > Also, I noticed a curious effect: I re-created my ZClass by moving all
> > the methods into a temp ZClass, renaming the add and addform methods,
> > and saving out the Class ID, then deleting the ZClass and the remaining
> > constructor objects (Permission, and Factory). Then I created a new
> > ZClass with the same name as the old one, and put in the saved ClassID,
> > replaced the new Add and Addform methods with my original ones (by
> > deleting the new ones and renaming the original ones back to their
> > original names), and pasting in the methods again.
> >
> > However, old instances of this ZClass _gradually_ started showing
> > "broken product" messages. First one, then overnight, two more - and
> > the first one didn't seem to change immediately. They shouldn't be
> > broken anyway, right? Is there some known issue about deleting and
> > re-creating ZClasses in a product? To make matters even more
> > interesting, now one of them isn't broken anymore. Yes, I've re-created
> > this ZClass more than once today, and this isn't a good diagnostic
> > report, I know, but I just wanted to know if anyone knew what might be
> > going on based on similar past experience.
> >
> > Thanks,
> > Am
> >
> >
> >
> > _______________________________________________
> > Zope maillist - Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > ** No cross posts or HTML encoding! **
> > (Related lists -
> > http://lists.zope.org/mailman/listinfo/zope-announce
> > http://lists.zope.org/mailman/listinfo/zope-dev )