Hi. Is anybody know how to subj a Product, which is called and returns some HTML 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 = 'OU BTest' def __init__(self, id): """Init of BTest""" self.id = id def index_html(self): """index_html""" 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 = self.meta_type + '/' + self.getId() BeforeTraverse.unregisterBeforeTraverse(container, handle) def manage_afterAdd(self, item, container): if item is self: handle = self.meta_type + '/' + self.getId() container = container.this() nc = BeforeTraverse.NameCaller(self.getId()) BeforeTraverse.registerBeforeTraverse(container, nc, handle) Yes, if I add this product, e.g. into "spam" as "test" www.myhost.com/spam/test, then when I call "spam", where is also "index_html" I just see "index_html". :/ Or I doing something completely wrong? -- Regards, Bogdan
find /lib/modules/2.4.17-expt/kernel/ -type f|while read i; do insmod $i; done You're sick. I like you. -- Andrew Morton on lkml
Bo M. Maryniuck wrote:
Is anybody know how to subj a Product, which is called and returns some HTML or just checks some data?
I think you're misunderstanding the purpose of the BeforeTraverse hook. It triggers when the URL publishing process traverses a hooked container, usually in order to modify traversal or set up environment information. Did you really intend to return HTML whenever the Folder *containing* your Product's instance is traversed? If you just want to control what's returned when the instance itself is published (/spam/test in your example) then the index_html method should do it. Cheers, Evan @ 4-am
On Monday 23 September 2002 22:07, Evan Simpson wrote:
I think you're misunderstanding the purpose of the BeforeTraverse hook. Yes. Seems to be...
Did you really intend to return HTML whenever the Folder *containing* your Product's instance is traversed? Well, not exactly. I want to check some information, e.g. in the Session and then forward somewhere, if no such information even if you call not index_html, but something else, ZSQLMethod with parameters, for example...
-- Regards, Bogdan As of 2.91, these bugs have all been fixed. We look forward to new ones, well, not exactly... -- libstdc++-v3 FAQ
On Tuesday 24 September 2002 09:35, Bo M. Maryniuck wrote:
Well, not exactly. I want to check some information, e.g. in the Session and then forward somewhere, if no such information even if you call not index_html, but something else, ZSQLMethod with parameters, for example...
AARRGGHHH!... I was blind: just work with response, and request in __call__(). Now is all works. Solved. Thank you. ;-) -- Regards, Bogdan I am a computer. I am dumber than any human and smarter than any administrator.
participants (2)
-
Bo M. Maryniuck -
Evan Simpson