[Zope-CMF] context.edit in content portal_skins

Yuppie schubbe@web.de
Mon, 15 Jul 2002 22:59:04 +0200


Hi Jim!

> In CMF->portal_skins->content there is a Python script called
> folder_edit which takes 2 parameters. Whats context.edit, where is it? I
> can't find it anywhere.

The context is the object on which the script is being called, in this 
case your PortalFolder. The PortalFolder class is defined in 
CMFCore/PortalFolder.py in your Products directory.

> I am adding an extra input field to contain some additional info. I am
> assuming that I need to send the 3rd parameter to context.edit the same
> way I send the first 2 parameters. This is my change.
> 
> Parameter List: title, description, creator, choice=' Change ' 
> 
> context.edit( title=title,
>               description=description,
>               creator=creator)
> 
> Of course gives me an error when I add creator.

By default, the PortalFolder has no property "creator".

You could do something like this:
<code>
   if context.hasProperty('creator'):
     context.manage_changeProperties(creator=creator)
   else:
     context.manage_addProperty('creator', creator, 'string')
</code>
But that's just a quick 'n' dirty hack.

If you want to do it right, you have to create your own Folder class. 
But I'll leave it up to somebody else to tell you how to do that.

Yuppie