On Thu, Oct 20, 2005 at 09:43:24PM +0200, Dieter Maurer wrote:
> >asonhe is not there, but vitester has a __getitem__ method which
> >executes a PageTemplateFile instance and returns it. I.e.
> Thus, it returns a string.
> However, ZPublisher requires that all intermediate traversal
> steps return an object which is not of a simple type and does
> have a docstring. A string is a simple type, you cannot use it
> during traversal...
Ahh.. that makes sense I guess. It just seems counterintuitive that you
can return a string in a normal function, but not in __getitem__.
> >But that way I can't put any values in there. How can I do this then?
> Can can return a wrapper and give it a docstring.
> class Wrapper:
> '''a wrapper around a string.''' # this is the docstring
> def __init__(self, str):
> self.str = str
> def __call__(self): return self.str
> Some security declarations might be necessary as well.
> Probably, a class attribute "__roles__ = None" is sufficient.
Okay, that will work.
Thanks so much for your help, I really appreciated it.
-----BEGIN GEEK CODE BLOCK-----
GCS/O d--@ s:+ a-- C++ UL+++$ P++ L+++ E- W+ N(+) o K? w O-- M- V
PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b++ DI+++ D+ G e- h !r y?
------END GEEK CODE BLOCK------
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -