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