[Zope-CMF] Trouble Adding New Content Types Using Zclass

Tres Seaver tseaver@digicool.com
Thu, 12 Apr 2001 21:29:51 -0400


Kenneth Bolton wrote:
> 
> This list has been a great resource for me in beginning to understand how
> the cmf works. I really appreciate the time the people at DC and elsewhere
> are willing to spend helping clueless newbies like myself.
> 
> First, the good news. I got the PortalPoll to work from the tutorial, didn't
> even have to rely on the zexp! So I followed the advice given here a few
> days ago and tried to hack out something less complicated than the Poll for
> my own edification and education.
> 
> Here is what I did:
> I made a product, let's call it WasteManagement, and added a Zclass called
> GarbageDump (base classes, I've tried it two ways, a:   ZObject,
> _ZClass_for_CatalogTool, _ZClass_for_DiscussionTool,
> _ZClass_for_PortalContent, _ZClass_for_PortalFolder,
> _ZClass_for_WorkflowTool, _ZClass_for_DefaultDublinCoreImpl, 

You *don't* want to mix the "tool" classes into content.

> and b: ZObject,
> _ZClass_for_PortalContent, _ZClass_for_DefaultDublinCoreImpl).

That looks right.

> I used the
> EditDone, EditForm, SearchableText, and view methods from PortalPoll, but
> subbed my own properties in where applicable, e.g. DumpName (string),
> DumpLocation (text), DumpContact (text), and DumpCapacity (int). I put a
> modified addPortalClassPy in WasteManagement that reads:
>  return
> context.manage_addProduct['WasteManagement'].GarbageDump.createInObjectManag
> er(id,context.REQUEST)

A PythonScript which is in the ZClass Product (WasteManagement) and called
from a FactoryTypeInformation's 'constructInstance' (as yours is) shouldn't
neet to do the "manage_addProduct" bit;  the FTI does that for you.  All
you should need to do is call "context.GarbageDump.createInObjectManager'.

Tres.
--
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org