[Zope] Creating and Updating ZClass instances

Kevin Dangoor kid@kendermedia.com
Fri, 17 Sep 1999 16:07:35 -0400


-----Original Message-----
From: Mayfield, Weatherby <weatherby.mayfield@eds.com>
To: zope@zope.org <zope@zope.org>
Date: Friday, September 17, 1999 3:36 PM
Subject: [Zope] Creating and Updating ZClass instances


>I'm trying to set up a simple trouble-ticket type application using Zope.
I
>defined a ZClass for the individual tickets and added a few instances
>through the management screens.  That all worked fine.  But here's the
catch
>-- I want the users to be able to create and update tickets through the
>regular web site rather than through the management screens and  I can't
>figure out how to do that.  Is it possible?  I keep having the feeling that
>what I'm trying to do is really simple but I just can't quite grasp it yet.

It is pretty straightforward. How exactly you set it up will probably depend
on your security requirements... The general process would be to make a DTML
method for updating an item that posts to another DTML method. The "update"
method would do something like:

<form method="post" action="SaveChanges">
<input type="text" name="name" value="&dtml-name;">
<textarea name="problem">&dtml-problem;</textarea>
<input type="submit" value="Save Changes">
</form>

then the "SaveChanges" method could do something like:

<dtml-call "propertysheets.basic.manage_changeProperties(REQUEST)">
(replacing "basic" with the name of your propertysheet)
<dtml-call reindex_object>
(if it is a CatalogAware object)

KM|net News has a working example of this, if you drill down to the
KMArticle ZClass and look at the "edit" and "postit" methods.

Kevin