[Zope] registerBeforeTraverse()

Bo M. Maryniuck b.maryniuk@forbis.lt
Mon, 23 Sep 2002 21:09:51 +0200


Hi.
Is anybody know how to subj a Product, which is called and returns some H=
TML=20
or just checks some data?

I still can't find how to make it work:

class OU(SimpleItem.Item, Implicit, ObjectManager):
    """Class of OU"""
    meta_type =3D 'OU BTest'   =20
    def __init__(self, id):
        """Init of BTest"""
        self.id =3D id

    def index_html(self):
        """index_html"""       =20
        return "<html><body>Test here...</body></html>"

    def __call__(self, container, req):
        """Should be before traverse hook?"""
        return "<b>On hook?</b>"

    def manage_beforeDelete(self, item, container):
        if item is self:
            handle =3D self.meta_type + '/' + self.getId()
            BeforeTraverse.unregisterBeforeTraverse(container, handle)
   =20
    def manage_afterAdd(self, item, container):
        if item is self:
            handle =3D self.meta_type + '/' + self.getId()
            container =3D container.this()
            nc =3D BeforeTraverse.NameCaller(self.getId())
            BeforeTraverse.registerBeforeTraverse(container, nc, handle)

Yes, if I add this product, e.g. into "spam" as "test"=20
www.myhost.com/spam/test, then when I call "spam", where is also "index_h=
tml"=20
I just see "index_html". :/

Or I doing something completely wrong?

--=20
Regards, Bogdan

> find /lib/modules/2.4.17-expt/kernel/ -type f|while read i; do insmod $=
i;=20
done
You're sick.  I like you.
=09-- Andrew Morton on lkml