[Zope] Why Doesn't This Python Expr. Work?

beno zope@thewebsons.com
Fri, 03 Jan 2003 17:29:00 -0400


At 05:24 PM 1/3/2003 +0100, you wrote:
>Am 03.01.2003, 15:29 Uhr
>         schr=F6b beno <zope@thewebsons.com>:
>
> > If I type this at the Python command prompt, I get the following:
>[...]
> > Yet, if I call it from a script, it works just fine for a string similar
> > to "x" but it adds an extra "_frame" for a string similar to "x_frame".
>
>A typo in your script? Works as expected here. One observation: you
>check for "frame" and append "_frame", if it's missing.

Well, that wasn't the problem. I dinked around with it for a while and=20
finally tried this:

import string

template_id =3D template_id[:-4]
if (string.find(template_id,'frame')=3D=3D(0 | -1)):
  template_id =3D template_id + '_frame'
content =3D 'here/' + template_id + '_content/macros/content'
print content
return printed

If the value can choose between 0 and -1 it works. Why? I don't know and I=
=20
don't care ;)
beno