[Zope] DTML batch processing w/external method

Dylan Reinhardt zope@dylanreinhardt.com
15 Apr 2003 10:46:27 -0700


Hmmm... the error you got was "global name 'start' is not defined"

Since there's no 'start' variable in this method, I'd have to assume
that your error is actually the return value of the remote procedure.

You mentioned that it works for literals... I wonder if some value
you've passed is empty, the wrong type or out of range.  You wouldn't
normally expect a variable to be undefined in such cases, but maybe
there's some validation procedure that only initializes a variable if
it's been passed a valid value.

Try checking the response before returning it and if it's not a list,
kick out both the error message *and* the URL you called.  It may be
informative.

If you can get your hands on it, you may want to dig into the remote
method as well... or at least find out what kinds of requirements it has
for accepting input.

HTH,

Dylan


On Tue, 2003-04-15 at 06:47, David Chandek-Stark wrote:
> Here's the external method:
> 
> #
> from xmlrpclib import ServerProxy
> def directory(skip, max):
>     s = repr(skip)
>     m = repr(max)
>     server_url
> = 'http://www.lib.duke.edu/texis/xmlrpc/directory/main.xml?skip='+s+'
> &maxrecs='+m
>     server = ServerProxy(server_url)
>     return server()
> #
> 
> It works fine when DTML passes literals:
> 
> <dtml-try>
>   <dtml-in expr="directory(0,25)" mapping>
>     <dtml-if sequence-start>
>       <table>
>     </dtml-if>
>     <tr>
>       <td><a href="http://www.lib.duke.edu/texis/directory/staff.html?id
> =&dtml-ID;"><dtml-var Person></a></td>
>       <td><dtml-var Phone></td>
>     </tr>
>     <dtml-if sequence-end>
>       <table>
>     </dtml-if>
>   </dtml-in>
> <dtml-except Fault>
>   XML-RPC Error!
> </dtml-try>
> 
> Thanks,
> David
> _____________________________________
> David Chandek-Stark
> Dept. of Web Services - Perkins Library, Duke University
> E-mail: d.chandek.stark@duke.edu
> Voice: 919.660.5859
> Fax: 919.684.2855
> 
> 
>                                                                                                                
>                       Dylan Reinhardt                                                                          
>                       <python@dylanrein        To:       David Chandek-Stark <chand012@mc.duke.edu>            
>                       hardt.com>               cc:       zope@zope.org                                         
>                                                Subject:  Re: [Zope] DTML batch processing w/external method    
>                       04/14/2003 05:43                                                                         
>                       PM                                                                                       
>                       Please respond to                                                                        
>                       python                                                                                   
>                                                                                                                
>                                                                                                                
> 
> 
> 
> 
> On Mon, 2003-04-14 at 14:01, David Chandek-Stark wrote:
> 
> > <dtml-in expr="external_method(start,size)" ...>
> >
> > doesn't work (NameError: global name 'start' is not defined).
> 
> The DTML looks OK.  Care to post the external method code?
> 
> Dylan
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )