[Zope] Hello All, Newbee here neds little help. Thanks
Jim Washington
jwashin@vt.edu
Fri, 08 Mar 2002 11:44:55 -0500
Ariel Rivera Merla wrote:
> Hi, im a newbee with ZOPE and with this mailing list trying to do the GUEST
> BOOK example thats on this page:
> http://www.zope.org/Members/michel/ZB/SimpleExamples.dtml
>
> At the end of the example theres a pytho script thats needed to finally make
> the GuestBook example work, so when i copy it from the page, and paste it on
> zope (creating a python script) , sope says that thescript has errors....
> Im not familiar with python, so if anyone could help, ill apreciate it.
> Thanks
>
> Heres the python script copied from the page above:
>
>
>
> ## Script (Python) "addEntry"
> ##parameters=guest_name, comments
> ##
> """
> 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')
>
Python is funny about indentation. Remove the leading spaces from each
line, and it should work. For future reference, anytime a statement
ends in a colon (:) you will need to assure indenting the succeeding
statement block uniformly. Welcome to Python!
-- Jim Washington