Hi; If I type this at the Python command prompt, I get the following:
import string template_id = "x_frame" if (string.find(template_id,'frame')==-1): ... template_id = template_id + '_frame' ... content = 'here/' + template_id + '_content/macros/content' print content here/x_frame_content/macros/content template_id = "x" if (string.find(template_id,'frame')==-1): ... template_id = template_id + '_frame' ... content = 'here/' + template_id + '_content/macros/content' print content here/x_frame_content/macros/content
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". Why? beno
Am 03.01.2003, 15:29 Uhr schröb 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. Jo. -- Internetmanufaktur Jo Meder ---------------------- Berlin, Germany http://www.meder.de/ ------------------- fon: ++49-30-417 17 63 33 Kollwitzstr. 75 ------------------------ fax: ++49-30-417 17 63 45 10435 Berlin --------------------------- mob: ++49-170- 2 98 89 97 Public GnuPG-Key ---------- http://www.meder.de/keys/jo-pubkey.txt
At 05:24 PM 1/3/2003 +0100, you wrote:
Am 03.01.2003, 15:29 Uhr schröb 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 finally tried this: import string template_id = template_id[:-4] if (string.find(template_id,'frame')==(0 | -1)): template_id = template_id + '_frame' content = '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 don't care ;) beno
participants (2)
-
beno -
Jo Meder