[Zope] Editing ZClasses - Hole in Documentation

complaw@hal-pc.org complaw@hal-pc.org
Thu, 15 Nov 2001 15:42:46 GMT


Casey:

As always, Thanks for your reply.

I did actually find out about the manage_editProperties way to change things. 
However, what is left unsaid (and was really the purpose of my message) was that
the way to set up the edit functionality in a ZClass is lacking.  How can I have
an extra method in a ZClass that sets up the edit screen and then tells a
particular function to perform the edit?  What I see now is that I have to have
a separate DTML method (for the edit form) and a separate python script or DTML
Method to actually modify the properties.

What would be really nice would be to have the ZClass wizard set up an
"editForm/edit" set of objects, just as it does the "addForm/add" objects.  If
you don't want the user to edit anything, simply restrict their access from the
editForm object.  That would make ZClasses much more attractive to site
developers that just want to have a few extra properties of say, a DTML
Document, but don't want to go through the hassle of making a python product.

The way the system works now is that ZClasses are relatively easy to make and a
real bear to edit (from the developer side).  This makes ZClasses intitially
attractive (because they are easy to make) but largely unwieldy in real life if
your application needs to edit parameters in classes (which happens all the
time).

I will look into the book.  Thanks for the plug.

Best wishes (to all),

Ron


> On Thursday 15 November 2001 06:55 am, Ronald L. Chichester allegedly wrote:
> [snip]
> > Some of us have products we would like to roll out that require that
> > users (including managers, owners, and yes, sometimes even anonymous (if
> > your organization can handle that)) to edit the ZClass instance once it
> > has been instantiated.  I'm still hunting for either documentation or an
> > example that has this capability.  In a few instances, I have seen
> > people say it is "trivial."  It may be, once you find out how.
> > Unfortunately, there is still some smoke and mirrors here.  The solution
> > isn't obvious to the casual developer.
> >
> > If someone can prove me wrong, I would be thrilled to know about it.
> >
> > Best,
> >
> > Ron
> 
> You dare to suggest that there is a capability of Zope that is undocumented? 
> I find the mere suggestion of this utterly infathomable!
> 
> Seriously, tho, the API of Zope and especially ZClasses is pretty opaque in 
> places, unless you like hunting through the source code, which in the case of 
> ZClasses doesn't help much without Jim F. looking over your shoulder... 8^)
> 
> Actually there is an example of how to do this right under your nose. The 
> default constructor method of the ZClass has the important call syntax in a 
> comment as an example. Something like:
> 
> <dtml-call expr="propertysheets.Basic.manage_editProperties(REQUEST)">
> 
> Now, manage_editProperties is fine so long as you want to change all of the 
> properties at once, but not if you only need to change one or two. For that, 
> use manage_changeProperties.
> 
> This call would work in response to a form (either from Python or DTML):
> 
> propertysheets.my_property_sheet.manage_changeProperties(REQUEST)
> 
> just make sure the ZClass instance is at the top of the namespace stack, 
> which is easily accomplished using the URL as in:
> 
> http://zope/path/to/instance/editMethod
> 
> <plug type="shameless">
> You can find a complete example of a ZClass based app in the newly-published 
> "Book of Zope" which is sadly only available in dead-tree form. Although you 
> can download the ZCatalog chapter at www.nostarch.com.
> </plug>
> 
> hth,
> /---------------------------------------------------\
>   Casey Duncan, Sr. Web Developer
>   National Legal Aid and Defender Association
>   c.duncan@nlada.org
> \---------------------------------------------------/
>