Hello All, Newbee here neds little help. Thanks
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') PD.- T H A N K S ________________________________ La información contenida en este correo electrónico es legalmente privada y confidencial. Cualquier uso, modificación, difusión y/o reproducción de cualquier persona distinta del destinatario está prohibida. Si Vd. recibe este mensaje por error, por favor bórrelo y comuníquelo al remitente.
Hard to know without seeing the error message. It might be the indentation of the script, since that is significant in Python. And please don't flag your messages as "high priority". It's annoying and it's hard for me to believe that working on a tutorial example could possibly be that all that urgent. Tom P [Ariel Rivera Merla] 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:
Hai, be shure to put the following statement on one line, in stead of two: (snip) 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')
PD.- T H A N K S ________________________________ La información contenida en este correo electrónico es legalmente privada y confidencial. Cualquier uso, modificación, difusión y/o reproducción de cualquier persona distinta del destinatario está prohibida. Si Vd. recibe este mensaje por error, por favor bórrelo y comuníquelo al remitente.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
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
participants (4)
-
Antwan Reijnen -
Ariel Rivera Merla -
Jim Washington -
Thomas B. Passin