[Zope] __bobo_traverse__ (Cont.)

Johan Carlsson johanc at easypublisher.com
Tue Aug 31 13:09:07 EDT 2004


Garito wrote:
> Thanks again Johan for your response
> getattr(self, 'Result') is a python script inside my product (my product
> is a container)
> I can't undersant the complexity in these case
> Perhaps could be interesant to explain what I try to do before continue
> these conversation
> I try to process TraversalRequestNameStack (traverse_subpath) as user query
> Then I would like to generate the response and serve it to the user
> For example:
> user tye some thing like:
> http://myserver:myport/MyProduct/Value1
> User wants Value1 in MyProduct
> Value1 is a processed value that returns: 'This is the result of
> precessing Value1'
> How could I do it? (Perhaps with these point of view we can understand
> ourselves better)
> 
> My thoughts:
> Override __bobo_traverse__ to process TraversalRequestNameStack because
> traverse_subpath is not available in products
> Then return the results to be printed in the screen
> 
> I assume these would be truly in fact easier :'(
> 
> These explanation illuminate you? (I hope so!!!)

I would simply add the to a special _v_attribute
in __bobo_traverse__ and return self and then have an overrided 
index_html method.
If the index_html method needs to be able to return something else
when the URL http://myserver:myport/MyProduct is accessed (for instance)
just let it check if the self._v_attribute is set.
I would set the class attribute _v_attribute=None.

Maybe setting a attribute in REQUEST is better, i'm not sure
from the top of my head if volatile are unique for a transaction,
they might possible be unique for a thread? Yeah I check it,
they are cached in ram so I guess they are bound to a thread.
Use REUQEST instead, it's tosed when the requests ends.

Regards,
Johan


> THANKS AGAIN
> 
> PD: Sorry for my english!



More information about the Zope mailing list