[Zope] Hello All, Newbee here neds little help. Thanks

Ariel Rivera Merla armerla@marco.org.mx
Fri, 8 Mar 2002 11:16:14 -0600


Thanks very much Jim, it worked.!

______________
La informaci=F3n contenida en este correo electr=F3nico es legalmente =
privada y
confidencial. Cualquier uso, modificaci=F3n, difusi=F3n y/o =
reproducci=F3n de
cualquier persona distinta del destinatario est=E1 prohibida. Si Vd. =
recibe
este mensaje por error, por favor b=F3rrelo y comun=EDquelo al =
remitente.=20

-----Original Message-----
From: Jim Washington [mailto:jwashin@vt.edu]=20
Sent: viernes, 08 de marzo de 2002 10:45
To: Ariel Rivera Merla
Cc: 'zope@zope.org'
Subject: Re: [Zope] Hello All, Newbee here neds little help. Thanks


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:=20
> http://www.zope.org/Members/michel/ZB/SimpleExamples.dtml
>=20
> At the end of the example theres a pytho script thats needed to=20
> finally make the GuestBook example work, so when i copy it from the=20
> page, and paste it on zope (creating a python script) , sope says =
that=20
> thescript has errors.... Im not familiar with python, so if anyone=20
> could help, ill apreciate it. Thanks
>=20
> Heres the python script copied from the page above:
>=20
>=20
>=20
>         ## Script (Python) "addEntry"
>         ##parameters=3Dguest_name, comments
>         ##
>         """
>         Create a guest book entry.
>         """
>         # create a unique document id
>         id=3D'entry_%d' % len(context.objectIds())
>=20
>         # create the document
>         context.manage_addProduct['OFSP'].manage_addDTMLDocument(id,
>                                                  title=3D"",=20
> file=3Dcomments)
>=20
>         # add a guest_name string property
>         doc=3Dgetattr(context, id)
>         doc.manage_addProperty('guest_name', guest_name, 'string')
>=20

Python is funny about indentation.  Remove the leading spaces from each =

line, and it should work.  For future reference, anytime a statement=20
ends in a colon (:) you will need to assure indenting the succeeding=20
statement block uniformly. Welcome to Python!

-- Jim Washington