ZPattens Question? Guestbook example
Hi James, Please don't post to the list in HTML. James Johnson wrote:
Hello, I'm trying to get the basic app building concept down with ZPatterns. Forgive me if I'm way off the mark. I'm building off the guest book example from the new Zope book. What I've done is created a product folder call Gbook. Inside I've created a dtml method index_html, a specialist named Guestbook and a Dataskin instance called Guestbook_entry. I have one property sheet named GBookProps defined for dataskin ZClass. Instead of storing the guestbook entries in documents I'm trying to store them using the dataskin database.
In the Specialist(Guestbook) I have 3 methods addEntry, addEntryAction, and addEntryForm When I call addEntry I get. TypeError sequence-index must be an integer I thought I was so close to understanding me not understanding. :) It seems to me that the "only" way to produce a ZPatterns based product is to do it from python. How about this, should I be trying to add entries this way? """dtml method addEntry""" <dtml-var standard_html_header> <center> <h2> Inserting new Guest Book Table Info Item!</h2> <dtml-let id="'entry_%d' % len(self.objectIds())"> ni="newItem(Guestbook)"> </dtml-let>
This is a bit odd -- you're closing your dtml-let tag immediately after opening it. Also, I don't understand your call to newItem. You should be passing an id into it.
<dtml-call "ni.propertysheets.manage_addPropertySheet (id='GBookProps', ns=''
You probably ought to close the bracket, quote and tag here.
<dtml-let nips="ni.propertysheets.get('GBookProps')">
The variable "ni" won't be bound to anything in particular here.
<dtml-call "nips.manage_addProperty('guest_name', guest_name, 'string')"> <dtml-call "nips.manage_changeProperties(REQUEST)">
</dtml-let> <form action=index_html> <input type=submit value="OK"> </form> </center>
You can use ZPatterns from DTML alone quite easily. However, some things are easier from an external method or a python method. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net
participants (2)
-
James Johnson -
Steve Alexander