[Zope] ZClass edit with a PythonScript

Tim Wilson wilson@isis.visi.com
Mon, 22 Apr 2002 21:44:58 -0500 (CDT)


Hi everyone,

I've built a more user-friendly edit form for a ZClass-based product.
Now I'd like to use a PythonScript as the action of the form to actually
process the changes. I think I'm 90% there, but I can't figure out how
to refer to the object that needs to be changed in the Script. In the
current version (included below), I'm referring to the object as
'newsitem', but how to I connect that name with the object itself?
Here's the code:

## Script (Python) "doEdit"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Edit a NewsClass instance
##
REQUEST = container.REQUEST
newsitem.propertysheets.Basic.manage_changeProperties(REQUEST)
if REQUEST['body'] != '':
  newsitem.propertysheets.Basic.manage_changeProperties(readmore=1)
else:
  newsitem.propertysheets.Basic.manage_changeProperties(readmore=0)  
newsitem.reindex_object()

RESPONSE = REQUEST.RESPONSE
if REQUEST.has_key('DestinationURL'):
  return
RESPONSE.redirect(REQUEST['DestinationURL']+'/manage_workspace')
return RESPONSE.redirect(REQUEST['URL2']+'/manage_workspace')

Any hints would be appreciated.

-Tim

--
Tim Wilson      |   Visit Sibley online:   | Check out:
Henry Sibley HS |  http://www.isd197.org   | http://www.zope.com
W. St. Paul, MN |                          | http://slashdot.org
wilson@visi.com |  <dtml-var pithy_quote>  | http://linux.com