[Zope] problem with superValues

Stefan H. Holek stefan@epy.co.at
Fri, 07 Mar 2003 20:29:44 +0100


superValues will only work after you have _setObject'ed your new object.=20
There is normally no acquisition context available during __init__. Your=20
factory method should look something like this:

  ob =3D MyClass('foo')
  self._setObject('foo', ob)
  self._getOb('foo').edit()

HTH,
Stefan


--On Freitag, 07. M=E4rz 2003 20:12 +0100 Steffen Hausmann=20
<steffen@hausmann-family.de> wrote:

> Im trying to send an E-Mail within an external python script each time
> an object is edited. Therefor I use superValues to locate the MailHost
> object.
>
> mailhost=3Dgetattr(self, self.superValues('Mail Host')[0].id)
>
> If the object that sends the mail already exists anything goes fine.
>
> But if the object is edited for the first time (via the __init__
> procedure that calls the edit procedure) superValues can't find the
> MailHost object (IndexError: list index out of range).

--
Those who write software only for pay should go hurt some other field.
/Erik Naggum/