[Zope-CMF] Problem creating products programatically

Gitte Wange gitte@mmmanager.org
03 Oct 2001 09:58:22 +0200


On ons, 2001-10-03 at 09:45, Josef Albert Meile wrote:
> I am having the following error message when I try to view an object 
> which has been created programatically:
> 
[SNIP error message]
> 
> I don't have this problem when I create the object from the portal 
> interface. I guess the problem could be the way that I am using to 
> create the objects or the location of the method getElement. This is 
> the code I am using to create the object:
> 
> context.portal_types.constructContent(type_name='FullTimeJob',
>                                       container=container,
>                                       id='test')
> 
> Does somebody know what I am doing wrong?
> Where should I put the method getElement?
> 
> My last question is:
> After creating the object programatically, how can I call its 
> editForm immediately?
 
When I create portal objects programatically, I first find the folder
where I want to put the object (mostly in the logged in members portal
folder). Then I call the invokeFactory method on this folder like this:
<dtml-let
user="portal_membership.getAuthenticatedMember().getUserName()"
          mem_folder="portal_membership.getHomeFolder(user)">
 <dtml-call "mem_folder.invokeFactory(id='someid',
type_name='Document')">
</dtml-let>

Hope this little code snippet can help you ....

-- 
Gitte Wange Jensen

Sys Admin, Developer and a lot more
MMmanager.org Aps, Denmark

Phone: +45 29 72 79 72
Email: gitte@mmmanager.org
Web: www.mmmanager.org

Quote of the day:
Chris McDonough:  "We should kill two birds with one stone with this..."
Ethan Fremen: "Oh, believe me, we've got LOTS of birds lined up to
die..."

    - Ethan Fremen, f2f conversation with chrism