[Zope] Re: Zope-Documentation: Args

Florent Guillaume fg at nuxeo.com
Sun Nov 13 10:13:00 EST 2005


Tino Wildenhain wrote:
>>I've found quite a lot of doc about the Zope built-in-functions. But 
>>very often I miss information about the args that can be passed to 
>>the functions, e.g. "manage_changeProperties". You find a description 
>>of the function, an example passing REQUEST, but I had to guess that 
>>you can pass a map as well.
>>
>>Any help? Am I blind or stupid? Probably both :)
> 
> 
> The quickest way - ideally you use ZEO for storage
> and have a client running for your web access,
> use another client instance like this:
> 
> --- interactive example -----
> 
> ./bin/zopectl debug
> Starting debugger (the name "app" is bound to the top-level Zope object)
> 
>>>>help(app.manage_changeProperties)
> 
> Help on function manage_changeProperties in module OFS.PropertyManager:
> 
> manage_changeProperties(self, REQUEST=None, **kw)
>     Change existing object properties.
> 
>     Change object properties by passing either a mapping object
>     of name:value pairs {'foo':6} or passing name=value parameters
> 
> --- end interactive example ----
> 
> 
> while app is your zope-root and you can reach any
> object via dotted notation and just try things
> out before you write code.

Well, except that in this case the docstring for manage_changeProperties 
is badly wrong, if you pass a mapping as first argument, it will think 
it's a request and render a page you'll never use as a result, which 
slows it down a lot.

The proper way to call manage_changeProperties is:
   manage_changeProperties(foo=6, bar='blah')
or
   manage_changeProperties(**somemapping)


I've been meaning to fix Zope for years but...


Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope mailing list