[Zope-CMF] programmatically add topics when adding a new crea
ted type
Al-Muthairi, Abdullah
Abdullah.Al-Muthairi@INTP.COM
Tue, 6 Aug 2002 14:26:55 -0700
thank you very much Mr. Rendell for your reply
but im not using products.i just copied the portal folder type with
modifying it without creating a new product.currently my factory method is
the same as the portal folder factory method.i tried copying the
"manage_addPortalFolder" factory method from the "PortalFolder" file to a
new file calling it "manage_addPortalAppDoc" and made it my new type factory
method but it didnt work.i got a failure but when i returned the factory
method to the portal folder factory method it worked find. how can i make it
work?so that i can add the code to autocreate the 2 topics with the creation
of the AppDoc type.and note i want to create the 2 topics with the creation
of the AppDoc type only.so if i put the code in the productName_edit.py file
i get 2 topics created everytime i edit my AppDoc type.
i really need help in this and thanx in advance
-----Original Message-----
From: Carl Rendell [mailto:cer@sol43.com]
Sent: Friday, August 02, 2002 8:40 AM
To: Al-Muthairi, Abdullah
Cc: zope-cmf@zope.org
Subject: Re: [Zope-CMF] programmatically add topics when adding a new
created type
On Friday, August 2, 2002, at 06:36 AM, zope-cmf-request@zope.org
wrote:
> Message: 8
> From: "Al-Muthairi, Abdullah" <Abdullah.Al-Muthairi@INTP.COM>
> To: "'zope-cmf@zope.org'" <zope-cmf@zope.org>
> Date: Thu, 1 Aug 2002 15:02:59 -0700
> Subject: [Zope-CMF] programmatically add topics when adding a new
> created type
>
> Hi everyone
>
> this is my first post here i would really like some help here.
> i created a new portal type called "Application Documentation" by
> copying a
> folder type and modifying its actions. It should contain meta data
> about the
> ineternally developed applications in the company and should also
> contain 2
> zope topics. One of the topics will be the applications documents
> and the
> 2nd is user contributions. Every time a new application
> documentation type
> is created these 2 topics should be created also. Any ideas how to
> automatically create the 2 topics with the creation of the type?
Within the edit script for your product (productName_edit.py), you
may add lines that create the two new topics:
# after you've created your new folder object...
folderObject = getattr(context,'folderName')
newTopics = {'app_docs' : { 'id' :'application_documents'
, 'title' : 'Application Documents' }
,'user cont' : { 'id' :'user_contributions'
, 'title' : 'User Contributions' }
}
for key in newTopics.keys():
folderObject.invokeFactory(type_name='Topic',
id=newTopics[key][id],
title=newTopics[key][id])
That will get the items created and preserve the name space. Within
the for loop you can add all of the other calls that you wish to
set up each topic the way you want to set up each topic, and
control these by extending the dictionary.
I do this pretty often with products, but not specifically with topics.
> i think it is achieved in the factory method (im still new to CMF
> and zope)
> which brings us to my 2nd question. where can i find the factory
> methods of
> the portal types?
>
All of the factory method dictionaries are in the various CMF
directories. Mainly CMFDefault.
> thank you very much for your time
Carl E. Rendell
Solution43
Information Distribution Consulting | "Ahhhh the power of
cer@sol43.com | acquisition" - Chef Z
The information contained in this email message may be privileged and is
confidential information intended only for the use of the recipient or any
employee or agent responsible for delivering it to the intended recipient.
Any unauthorized use, distribution or copying of this information is
strictly prohibited and may be unlawful. If you have received this
communication in error, please notify the sender immediately and destroy the
original message and all attachments from your electronic files.