[Zope3-Users] Simple Acquisition

Garanin Michael garanin at m-lan.ru
Sat Feb 4 18:27:37 EST 2006


                                                                          
В Сбт, 04/02/2006 в 21:01 +0100, Jean-Marc Orliaguet пишет:
>                                                                           David Johnson wrote:
> 
> >>>I have created a ZPT Page which I have no trouble accessing:
> >>>
> >>>http://localhost/index.html
> >>>
> >>>
> >>>
> >>>However, if I try to access it from the following URL, I see the
> >>>contents of MyFolder instead of the index.html.
> >>>
> >>>http://localhost/MyFolder/index.html
> >>>
> >>>What is the proper way to acquire "index.html" in other contexts?
> >>>      
you can overwrite traverse-behavior for 'your folders': write simple
Traverse-adapter for you folders. 
What is 'your folders'? It's folders implements
'IMyAcquisitionBehavior'. 

This adapter will has  'traverse'-method.
example(only idea):

class MyAcquisitionTraverse:
  __used_for__ = myproduct.interfaces.IMyAcquisitionBehavior
....
  def traverse(self, name):
     my_folder = self.context
     parent_folder = my_folder.__parent__ 
     return zapi.traverse(parent_folder, name) 














More information about the Zope3-users mailing list