"subforlder" question - on Guest Book example (ZopeBook)
Hi, I'm trying my first stuff with Zope, following the ZopeBook's examples. Now I'm trying the obviously important feature of letting (Anonymous) users add and list "messages", so I'm studing the Guest Book example that has a simple index_html (with the natural loop on the users' messages), and the standard Form + Action + Script stuff for adding messages. Users' messages are added in the same folder where the "machinery" is, but I would prefere to have them in a "Entries" subforder. My question is: how should I do that. The solution I've found is to change the original add Script (to be found at this message's end) to accept and additional parameter (the subfolder) and to change all the references to "context" to that parameter. That works, but I feel I can (and should?) get the same effect just by rearranging the way the GusetFolder is organized and let acquisition do the magic of having the subfolder to be "passed" as context. Any hint? TIA, Luca. -------------------- addEntryAction (DTML Method) <dtml-var standard_html_header> <dtml-call expr="addEntry(guest_name, comments)"> <h1>Thanks for signing our guest book!</h1> <p><a href="<dtml-var URL1>">Return</a> to the guest book.</p> <dtml-var standard_html_footer> -------------------- addEntry (Script) """ Create a guest book entry. """ # create a unique document id id='entry_%d' % len(context.objectIds()) # create the document context.manage_addProduct['OFSP'].manage_addDTMLDocument(id, title="", file=comments) # add a guest_name string property doc=getattr(context, id) doc.manage_addProperty('guest_name', guest_name, 'string')
participants (1)
-
Luca Manini