<P>
&nbsp; <BR>
<BR>
<BR>
On Thu, 07 Sep 2006 David H wrote :<BR>
&gt;Martijn Pieters wrote:<BR>
&gt;<BR>
&gt;&gt;cpdm cadlab wrote:<BR>
&gt;&gt;&nbsp; <BR>
&gt;&gt;&gt;&nbsp; thanks for the quick reply. I am glad to be here on active ZOPE<BR>
&gt;&gt;&gt;mailing list.<BR>
&gt;&gt;&gt;&nbsp; &nbsp; <BR>
&gt;&gt;<BR>
&gt;&gt;Let's keep it on the list then; no personal email please.<BR>
&gt;&gt;<BR>
&gt;&gt;&nbsp; <BR>
&gt;&gt;&gt;&nbsp; I had initially done the way you have suggested, but it doesn't work<BR>
&gt;&gt;&gt;in the sense I get a empty list as output, which I know isn't empty.<BR>
&gt;&gt;&gt;&nbsp; &nbsp; <BR>
&gt;&gt;<BR>
&gt;&gt;Then something is wrong with the external method. Use a debugger (pdb,<BR>
&gt;&gt;Wing, Komodo, etc.) or spurious logging (import logger;<BR>
&gt;&gt;logger.getLogger('yourmodule').log) to trace your code.<BR>
&gt;&gt;<BR>
&gt;&gt;&nbsp; <BR>
&gt;&gt;&gt;This made me think that I was making silly mistake. If I run external<BR>
&gt;&gt;&gt;method in python shell it shows the mlist, which is non-empty, but if I<BR>
&gt;&gt;&gt;ask the same to python script to do what it prints is this : []<BR>
&gt;&gt;&gt;&nbsp; What do you think is wrong. A further code goes like this:<BR>
&gt;&gt;&gt;mlist = context.code(uparam)<BR>
&gt;&gt;&gt;if len(mlist) == str(0):<BR>
&gt;&gt;&gt;&nbsp; &nbsp; print &quot;Sorry no suitable method found in database&quot;<BR>
&gt;&gt;&gt;&nbsp; &nbsp; return printed<BR>
&gt;&gt;&gt;else:<BR>
&gt;&gt;&gt;&nbsp; &nbsp; print mlist<BR>
&gt;&gt;&gt;&nbsp; &nbsp; return printed<BR>
&gt;&gt;&gt;&nbsp; &nbsp; <BR>
&gt;&gt;<BR>
&gt;&gt;Use &quot;if not len(mlist):&quot;; comparing the length to str(0) is always<BR>
&gt;&gt;false. &quot;len&quot; returns an integer, not a string, so 0 == '0' will never be<BR>
&gt;&gt;True.<BR>
&gt;&gt;<BR>
&gt;&gt;You can also call the external method directly if you encode the<BR>
&gt;&gt;arguments passed to it in the query string. Just open up a python<BR>
&gt;&gt;propmt, import urllib and call urllib.quote on your argument list to<BR>
&gt;&gt;hand-construct a URL.<BR>
&gt;&gt;<BR>
&gt;&gt;Moreover, get decent books on Python and on Web programming in general.<BR>
&gt;&gt;<BR>
&gt;&gt;Martijn Pieters<BR>
&gt;&gt;&nbsp; <BR>
&gt;Martijn,<BR>
&gt;<BR>
&gt;I wonder which books would recommend?&nbsp; Best I can say is that books just about HTTP are probably the least appreciated and often the most useful.<BR>
&gt;<BR>
&gt;David<BR>
&gt;<BR>
Well sure it takes time to acquire etiquette for newcomer. I am stuck but hopefully will solve it out. thanks a lot to both of you.<BR>
<BR>
m.d.<BR>

</P>
<br><br>
<a href="http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/1507191490@Middle5?PARTNER=3"><IMG SRC="http://adworks.rediff.com/cgi-bin/AdWorks/sigimpress.cgi/www.rediff.com/signature-home.htm/1963059423@Middle5?OAS_query=null&PARTNER=3" BORDER=0 VSPACE=0 HSPACE=0></a>