[Zope-PTK] Re: AW: [Zope-PTK] PTK
Steve Alexander
steve@cat-box.net
Mon, 19 Jun 2000 16:10:53 +0100
Hi Wolfgang,
I've replied to the PTK list, so that any others who might have a
similar question can chime in.
DETKE WOLFGANG wrote:
>
> Hallo Steve,
>
> I would like to test your proposal but can you tell me in which file/folder
> the function "addfoo()" is defined.
"Foo" is just an made-up example word that should be taken to mean "any
kind of arbitrary...". Sorry if I've been confusing.
Assuming that your own new PortalContent type is called a "Foo", the
python file it is defined in will be called Foo.py (perhaps -- you can
choose a different name if you want to).
This file contains the following:
--------
various imports
addFoo function that creates a new Foo object in the
folder/objectmanager context it is passed.
class Foo
containing various methods
Globals.default__class_init__(Foo)
from Products.PTKBase.register import registerPortalContent
registerPortalContent(Foo,
constructors=(addFoo,),
action='Wizards/Foo',
icon="../myProduct/Foo.gif")
--------
Take a look in PTKBase/NewsItem.py for an example. My code would go in
the addNewsItem function.
In answer to your actual question, the function addFoo is defined by
you, as part of your Foo class that represents portal content of the Foo
type. It is just an example.
In general, Kevin Dangoor's suggestion of giving the addFoo method the
proxy role of Contributor is a more elegant solution.
Hope this helps.
--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net