[Zope3-dev] xml-rpc comments

Jim Fulton jim at zope.com
Thu Aug 26 06:58:25 EDT 2004


Jim Fulton wrote:
> 
> I don't like the defaultView concept we have for xmlrpc now.
> 
> Imagibe we had an xml-rpc view named 'statistics', with methods
> 'summary' abd 'detailed', for reporting statistics on polls.
> 
> You could access the summary method as:
> 
>    .../poll/statistics/summary
> 
> You might want to be able to access the summary method
> as if it was a method of the poll:
> 
>    .../poll/summary
> 
> I think this has value, and the xml-rpc defaultView mechanism
> lets you do this, howeverm it creates an ambiguity.  Suppose there
> was an xml-rpc view named 'summary'. Which one would we get?
> As things stand now, the summary view would take precedence over
> the method, which is good, however, I'd really rather not
> create this ambiguity in the first place.
> 
> Rather than having a defaultView, I'd prefer to have zmlrpc method and
> methods directives (similar to browser page and pages directives) that
> allow the creation of xml-rpc views that are individual methods.  So, if
> someone wanted to be able to use the summary method directly, then would
> create a directive like:
> 
>   <xmlrpc:method
>       name="summary"
>       for=".IPoll"
>       permission="MrPoll.ManagePolls"
>       class=".PollStatistics"
>       />
> 
> or:
> 
>   <xmlrpc:methods
>       for=".IPoll"
>       permission="MrPoll.ManagePolls"
>       class=".PollStatistics"
>       >
>       <xmlrpc:method name="summary" />
>       <xmlrpc:method name="detail" />
>   </xmlrpc:methods>
> 


Another option is to make the name attribute optional
in the view directive:

    <xmlrpc:view
        for=".IPoll"
        allowed_attributes="summary detail"
        permission="MrPoll.ManagePolls"
        class=".PollStatistics"
        />

This would look better if it was:

    <xmlrpc:view
        for=".IPoll"
        methods="summary detail"
        permission="MrPoll.ManagePolls"
        class=".PollStatistics"
        />

This works for me.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org



More information about the Zope3-dev mailing list