[Zope] Changing External Python Methods

Casey Duncan casey@zope.com
Mon, 9 Sep 2002 10:06:33 -0400


If you run zope in "Debug" mode (-D switch on start), then it will check =
the=20
file everytime the external method is executed, reloading it if it has=20
changed.

-Casey

On Monday 09 September 2002 09:51 am, Gidon Friedman wrote:
> update you script in the ZMI after changes. zope doesn't monitor your=20
> file system, you have to tell zope that you made changes to the file.
>=20
> regards
>=20
> gidon
>=20
>=20
> Andreas Tille schrieb:
> > Hello,
> >=20
> > I'm fiddling arround with some External Python Methods and I have to =
admit
> > that it is a real pain to debug those Methods - at least I did not fo=
und a
> > reasonable way.  It makes me really crazy ist the fact that it seems =
that
> > Zope just caches the first version of the file which I putted into th=
e
> > Extensions directory and later changes are simply ignored.
> >=20
> > For instance I just try to do some processing onto an image named
> > bland.gif which is in the same folder of ZMI as the External Method.
> > I've got a.
> >=20
> >    Error Type: IOError
> >    Error Value: [Errno 2] No such file or directory: 'bland.gif'
> >=20
> > Well, besides the fact that I would like to know how to reference tho=
se
> > files I really want to know why the following code stolen from
> > http://www.zopelabs.com/cookbook/1010702887 works
> >=20
> >     def MakeThumbHi2(self, image=3D"test"):
> >=20
> > =09    oriImage =3D self.restrictedTraverse(image)
> > =09    oriFile =3D cStringIO.StringIO(oriImage.data)
> >=20
> > =09    image =3D PIL.Image.open(oriFile)
> > =09    image.thumbnail(100, 100)
> > =09    image_type =3D image.format
> >=20
> > =09    thumbnailImage =3D cStringIO.StringIO()
> > =09    image.save(thumbnailImage, image_type)
> > =09    thumbnailImage.seek(0)
> >=20
> > =09    return thumbnailImage.getvalue()
> >=20
> > and if I just replace my very own External Method by just this code
> > snipped (please note: there is no string 'bland.gif' in it - it was j=
ust=20
in
> > my former broken code)  I get the very same error message with the mi=
ssing
> > file 'bland.gif'.  It seems that there is something cached and I woul=
d
> > like to know how to get the changed version into this cache.  Moreove=
r
> > it would be nice to enlighten me about some other way to reference
> > files in the same ZMI folder from External Methods besides this way
> > to ship a parameter.
> >=20
> > Kind regards
> >=20
> >         Andreas.
> >=20
> >=20
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -=20
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
>=20
>=20
>=20
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -=20
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>=20