[Zope-CMF] ProtocolError with xml-rpc

Tres Seaver tseaver@zope.com
Thu, 06 Dec 2001 08:11:56 -0500


Pascal Samuzeau wrote:

> Hi,                                                                   
>                                                                       
> I have a script as :                                                  
>                                                                       
> identifiant = 'NEwDocument'                                           
> import xmlrpclib                                                      
> x=xmlrpclib.Server("http://127.0.0.1/MySite/Members/Samuzeau/")       
> x.invokeFactory('Document',identifiant)                               
>                                                                       
> When I run it I've got the following Error, and I can't do the rest of
> the script                                                            
>                                                                       
>     y=x.invokeFactory('Document',identifiant)                         
>   File "/usr/local/lib/python2.2/xmlrpclib.py", line 820, in __call__ 
>     return self.__send(self.__name, args)                             
>   File "/usr/local/lib/python2.2/xmlrpclib.py", line 974, in __request
>     verbose=self.__verbose                                            
>   File "/usr/local/lib/python2.2/xmlrpclib.py", line 847, in request  
>     headers                                                           
> xmlrpclib.ProtocolError: <ProtocolError for                           
> 127.0.0.1:8080/MySite/Members/Samuzeau/: 302 Moved Temporarily>       
>                                                                       
> What is the problem ?                                                 


Because you are publishing the 'invokeFactory' method directly,
it is (incorrectly, in your case) redirecting the response.
To avoid the redirect, add a PythonScript to your custom skin
which calls 'invokeFactory' but does not then redirect::

   ## Script (Python) "xmlrpc_invokeFactory"
   ##title=Call 'invokeFactory' without redirecting
   ##parameters=id,type_name
   context.invokeFactory( id=id, type_name=type_name )
   return 'Added object "%s" of type %s" % ( id, type_name )

> See http://www.zope.org/Products/PTK/Tracker for bug reports
> and feature requests


Could you report the bug (that 'invokeFactory' redirects in all
cases when published directly) to the tracker at the link above?

Thanks.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com