Is there a way to distinguish whether a request was made from a browser (no, not a particular browser) or from XMLRPC ? I would like to be able to tailor my responses to rpc requests so that I don't get a whole web page sent back when a value would do. Particularly, object creation code usually refers back to the management page of it's container, which isn't the response I want for rpc, success or failure would be preferable. Also, when Zope has a fault on XMLRPC, should it be sending back that big 'Zope Error....' message, according to the XMLRPC spec? J. Toman
At 09:35 2003-01-14 -0800, toman wrote:
Is there a way to distinguish whether a request was made from a browser (no, not a particular browser) or from XMLRPC ? I would like to be able to tailor my responses to rpc requests so that I don't get a whole web page sent back when a value would do. Particularly, object creation code usually refers back to the management page of it's container, which isn't the response I want for rpc, success or failure would be preferable.
Sidenote: Most products inspect the REQUEST parameter. Consider this method: def manage_addMyProduct(self, id, title, REQUEST=None): foo = bar if REQUEST is not None: # method called via the web, then don't em' hanging here self.REQUEST.RESPONSE.redirect(somewhere)
Also, when Zope has a fault on XMLRPC, should it be sending back that big 'Zope Error....' message, according to the XMLRPC spec?
J. Toman
_______________________________________________ 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 )
toman wrote at 2003-1-14 09:35 -0800:
Is there a way to distinguish whether a request was made from a browser (no, not a particular browser) or from XMLRPC ? I would like to be able to tailor my responses to rpc requests so that I don't get a whole web page sent back when a value would do. Particularly, object creation code usually refers back to the management page of it's container, which isn't the response I want for rpc, success or failure would be preferable. Zope assumes an XMLRPC request iff "REQUEST_METHOD == 'POST' and Content-Type == 'text/xml'".
You can access "REQUEST_METHOD" directly via "REQUEST" and "content-type" via the "REQUEST" method "get_header".
Also, when Zope has a fault on XMLRPC, should it be sending back that big 'Zope Error....' message, according to the XMLRPC spec? I think, Casay changed this for Zope 2.6.
Dieter
participants (3)
-
Dieter Maurer -
Peter Bengtsson -
toman