[Zope] publishing a double-underscore method?
Paul Winkler
pw_lists@slinkp.com
Tue, 6 May 2003 14:45:17 -0400
On Tue, May 06, 2003 at 03:36:02PM -0700, Dylan Reinhardt wrote:
> Hi all,
>
> I'm working on a product where I want to publish the results of a custom
> __getattr__ method. I realize overriding __getattr__ isn't generally
> recommended, but it fits my specific requirements for this product.
>
> The problem I'm having is that even very trivial returns from
> __getattr__ kick out the "empty or missing docstring" error.
>
> A trivial example that doesn't work:
>
> ----------
> security.declarePublic('__getattr__')
>
> def __getattr__(self, name):
> """ I have a docstring, not that it seems to matter """
right, you're not visiting http://mysite/foo/__getattr__
so the publisher doesn't care whether __getattr__ has a docstring.
> if name == 'test':
> return 'this is a test'
so you're visiting http://mysite/foo/test?
i guess the problem is that 'test' and/or 'this is a test'
do not have docstrings. i'm not sure which is the problem.
try using some type other than strings, something with a docstring?
anyway, all that said, i think you might consider using
__bobo_traverse__ instead of __getattr__. That's what it's for.
--
Paul Winkler
home: http://www.slinkp.com
"Muppet Labs, where the future is made - today!"