Here's his code -----Original Message----- From: Aseem Mohanty [mailto:aseem@neurobehavioralsystems.com] Sent: Tuesday, 18 June 2002 2:36 a.m. To: Chris Beaven Subject: Re: [Zope] another DTML ques I return the list via a python function: import string s = str(s_arg) s = s.replace('[','') s = s.replace(']','') s = s.replace('\'','') s = s.replace('"','') ret = s.split(',') return ret s_arg needs to look like "['test','test_str','yes']" the str() is primarily to get around an attribute error any leads as to why it might be failing... I did check it out on the interpreter and it returns a list. -AM Chris Beaven wrote:
I just set up the same situation and it worked for me... (ie I get YES back) My guess is that you aren't returning a list.
My get_list() looked like: return ['test','test_str','yes']
-----Original Message----- From: Aseem Mohanty [mailto:aseem@neurobehavioralsystems.com] Sent: Tuesday, 18 June 2002 2:19 a.m. To: zope@zope.org Subject: [Zope] another DTML ques
I have a PyScript that returns a list of strings
Somehow I am unable to do the following:
<dtml-let ll="get_list()"> <dtml-if "'test_str' in ll"> YES <dtml-else> NO </dtml-if> </dtml-let>
I know that 'test_str' is in the list. The if test fails always. What am I doing wrong??
TIA AM
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
Chris Beaven writes:
Here's his code
-----Original Message----- From: Aseem Mohanty [mailto:aseem@neurobehavioralsystems.com] Sent: Tuesday, 18 June 2002 2:36 a.m. To: Chris Beaven Subject: Re: [Zope] another DTML ques
I return the list via a python function:
import string s = str(s_arg)
s = s.replace('[','') s = s.replace(']','') s = s.replace('\'','') s = s.replace('"','') ret = s.split(',') return ret
s_arg needs to look like "['test','test_str','yes']" I expect blanks to cause the failing "'test_str' in ret".
Try: "ret= map(string.strip,ret)" Dieter
Right on target. I looked at the output later and got leading blanks. Thanks. AM Dieter Maurer wrote:
Chris Beaven writes:
Here's his code
-----Original Message----- From: Aseem Mohanty [mailto:aseem@neurobehavioralsystems.com] Sent: Tuesday, 18 June 2002 2:36 a.m. To: Chris Beaven Subject: Re: [Zope] another DTML ques
I return the list via a python function:
import string s = str(s_arg)
s = s.replace('[','') s = s.replace(']','') s = s.replace('\'','') s = s.replace('"','') ret = s.split(',') return ret
s_arg needs to look like "['test','test_str','yes']" I expect blanks to cause the failing "'test_str' in ret".
Try: "ret= map(string.strip,ret)"
Dieter
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
participants (3)
-
Aseem Mohanty -
Chris Beaven -
Dieter Maurer