BYTE.com
RSS feed

Newsletter
Free E-mail Newsletter from BYTE.com
Email Address
First Name
Last Name




 
    
             
BYTE.com > Tangled in the Threads > 2000 > January

Posting And Editing <dtml-calendar> Entries

By Jon Udell

January 21, 2000

(A Zope Primer :  Page 3 of 3 )



In this Article
A Zope Primer
Displaying ZODB Properties In <dtml-calendar>
Posting And Editing <dtml-calendar> Entries
As shown above, the DTML code forms a link that an authenticated user can follow to post or edit a calendar entry. The link refers to the DTML document editCalPropForm, and passes it both the property name (2000/01/17) and the url-quoted property value.

Here's editCalPropForm:
<dtml-var standard_html_header>

<form action="editCalendarProperty"> <input name="prop" type="hidden" value="<dtml-var prop>"> <b><dtml-var prop></b>: <br> <textarea name="propval" rows="15" cols="65" wrap="hard"> <dtml-var propval> </textarea> <br> <input type="submit" value="edit"> </form>

<dtml-var standard_html_footer>

It produces a form like the one shown in this image:

If the current day's property does not yet exist, the TEXTAREA will contain 'None'.

The action wired to this form is an external method, editCalendarProperty:

def editCalendarProperty(self,REQUEST,RESPONSE):
if ( self.hasProperty(REQUEST['prop']) ):
self.manage_changeProperties({ REQUEST['prop'] : REQUEST['propval'] })
else:
self.manage_addProperty(REQUEST['prop'], REQUEST['propval'], 'string')
return REQUEST.RESPONSE.redirect(REQUEST['BASE2'])

When the property exists, this method updates its value. Otherwise, this method creates the property and adds the new value.

What's an external method? It's a piece of pure Python code, which you place in the extensions subdirectory of your Zope installation, and bind into Zope by way of the management interface. Why use an external method? As it turns out, you don't have to in this case. You can do the same things in DTML, using <dtml-call> to invoke the Zope manage_ functions that add and modify index_html's properties.

Previous page Page 3 of 3 


BYTE.com > Tangled in the Threads > 2000 > January
Dr. Dobb's Media Center
BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE: Volume 2 - Heuristic Algorithms
The Best of BYTE: Volume 2 - Heuristic Algorithms
In this volume of Best of BYTE, we explore the emergence of some heuristic algorithms. Although we have only scratched the surface of this intriguing subject, we hope we've suggested the potential of the synthesis of heuristics and algorithms.

© 2008 Think Services, Privacy Policy, Terms of Service, United Business Media Limited
Site comments: webmaster@byte.com
Web Sites: BYTE.com, dotnetjunkies.com, Dr. Dobb's Journal, SD Expo, Sys Admin, sqljunkies.com, Unixreview



MarketPlace
Fast online exception analysis. Capture customer crash data online.
Develop 10 times faster ! ALM, IDE, .Net, RAD, 5GL, Database, 5GL, 64-bit, etc. Free Express version
Easily create an automated, repeatable process for building and deploying software.
AdminiTrack offers an effective web-based bug tracking system designed for professional software development teams.
Develop distributed systems conforming to open standards like CORBA and Web Services faster with SANKHYA Varadhi - The Digital Bridge.
Wanna see your ad here?
 

web2