[Zope-CMF] Re: Easiest way to make my own portal_type that is like CMFDocument but with extra properties

Lynn Walton waltonl@franklin.edu
Wed, 22 Aug 2001 01:35:07 -0500


Tres, your answer's helped me greatly, particularly realizing where inheritance does NOT
come into play.  Now I have one more thing I want to confirm.

After doing what I described earlier,  (made my own product, made a zclass in it  using
CMFDocument as a Base class, gave that zclass some new properties,
customized some skins for viewing/editing/editing metadata, here is how I ended up
getting my properties to be saved. It seems to be working but I'm not sure if it is
really the "right or best" way?

I made a custom skin, based on the document_edit that is in content which had:
------content's document_edit ------
parameters: text_format, text, file='',  SafetyBelt=''

context.edit(text_format,
             text,
             file,
             safety_belt=SafetyBelt)

qst='?portal_status_message=Document+changed.'
context.REQUEST.RESPONSE.redirect( context.absolute_url() + '/document_edit_form' + qst
)
------------------------

and I made my custom one take the extra 3 parameters for my 3 properties
like:
text_format, text, file='', topMenuExpand='', secondMenuExpand='', highlightMenu='',
SafetyBelt=''

and added
context.propertysheets.FU_CMFDocumentPropertySheet.manage_changeProperties({'topMenuExpand':topMenuExpand,'secondMenuExpand':secondMenuExpand,'highlightMenu':highlightMenu})

after the
context.edit(text_format,
             text,
             file,
             safety_belt=SafetyBelt)

and changed the return to be my custom edit_form skin
context.REQUEST.RESPONSE.redirect( context.absolute_url() + '/FUDocument_edit_form' +
qst )


Does that sound right? Is there a better way to get the properties saved than calling
manage_changeProperties and
explicitly building the dict with the arguments?  Can you get it to get them from the
request and if so how?


Also:

> Tres said:
> This is a bug in the tool:  for now, you can work around the
> problem by leaving "Visible?" unchecked when adding the action,
> and then checking it and clicking save after adding it.  Here is
> a patch for the problem, which I am about to check in:

Thanks for explaining this.

All for now,
Lynn