[Zope] __bobo_traverse__ help

Garito garito at sistes.net
Tue Nov 7 20:50:57 EST 2006


Hi all!

Please consider this code:

def __bobo_traverse__(self, REQUEST, name):
        obj = self.Propiedad(name)
        if obj is None: return self
        else: return obj

def Propiedad(self, propiedad):
    obj = getattr(self, propiedad, None)
    if obj is None: return obj # Añadir busqueda al catalogo
    else:
        if type(obj) == type(str('')) and obj.startswith('[') and 
obj.endswith(']'):
            return self.Expresion({'Expresion': obj[1:-1]})['Resultado']
    return obj

I wonder why I can do:

<tal:b tal:replace='python: here.Propiedad("Modificacion")' />

but not:

<tal:b tal:replace='here/Modificacion' />

Where Modificacion is a property that starts with '[' and ends with ']'
and Expresion is a member who evaluates the expresion as a TAL expresion 
and put the result in a dictionary with the key 'Resultado'

When I try here/Modificacion an unauthorized error trying to access 
Modificacion

Can you explain me what is happening, please?

Thanks!

-- 
Mis Cosas
http://blogs.sistes.net/Garito




More information about the Zope mailing list