[Zope] Zoo guestbook example.

Ignacio Valdes ivaldes@hal-pc.org
Sun, 18 Feb 2001 18:08:45 -0600


Dieter Maurer wrote:

> Ignacio Valdes writes:
>  > Dieter Maurer wrote:
>  > > Apparently, your "self" is a string
>  > > while you expect it to be an object.
>  > Okay, how to fix it?
> Where does your "self" come from?
>
> Dieter

I'm from Georgia originally, but I grew up in Texas :-) Markus
Kemmerling suggested replacing 'context' in the code below with 'self'
using this code:
  id='entry_%d' % len(self.objectIds())
  self.manage_addDTMLDocument(id, title="", file=comments)
  doc=getattr(self, id)
  doc.manage_addProperty('guest_name', guest_name, 'string')

and says this works with Zope 2.2.4, but I can only use 2.2.2 for the
time being.

The original code from the Zope book example at
http://www.zope.org/Members/michel/ZB/SimpleExamples.html is:
      """
      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')

This is the basic functionality I would need for a medical software
rating site. Unfortunately, I can only use Zope 2.2.2 as it will be
running on a production site that I don't control.

Thanks,

-- IV