As I’m still experimenting with this maybe someone here could answer that one:

I have PythonScripts or PageTemplates inside a folderish container in the tree:

root
- folder1
— object1
— folder2
—— script1
—— script2
—— template1

I’d like object1 to acquire script1, script2 and template1 from folder2 as if 
they were attributes/methods of object1, though they’re not.

I’ve played around with modifying __of__ and tried some stuff with __getattr__ 
and __getattribute__, but no success so far.

A simple 

    def __of__(self, parent):
      """ ... """
      return self.__of__(self.folder2)

in the class of object1 is not working as it always returns "The object at 
root.folder2 has an empty or missing docstring. Objects must have a docstring 
to be published.“

the object1 class definitely has a docstring.

Any hints how to achieve what I’m trying? Wrong approach?

Best, Sebastian

> Anfang der weitergeleiteten Nachricht:
> 
> Von: Sebastian Tänzer <s...@taenzer.me>
> Betreff: __bobo_traverse__ or similiar with python tales expression?
> Datum: 11. Juli 2015 19:53:29 MESZ
> An: zope@zope.org
> 
> Hello fellow Zopees,
> 
> the product we’re using (ZMS) allows methods as attributes to custom object 
> models. These methodes (PythonScript) are created inside a metamanager 
> container as „Wiki.mymethod“, where Wiki is the meta type of the custom 
> object.
> 
> The pathhandler method of these custom objects modifies __bobo_traversal__ 
> for normal http requests and maps these non-existing methods in that context 
> to existing methods in the metaobj_manager container using the context 
> meta_id.
> 
> Calling the same method from a PageTemplate or other PythonScript does not 
> reflect that and - not surprisingly - returns an AttributeError:
> 
> File 
> "/opt/python/zope2-pip/lib/python2.7/site-packages/Products/PageTemplates/ZRPythonExpr.py",
>  line 
> 48, in __call__
>    return eval(self._code, vars, {})
>  File "PythonExpr", line 1, in <expression>
> AttributeError: dummyFunction
> 
> Is there a way to modify traversal behaviour from the Product or somehow 
> different?
> 
> Best
> Sebastian


_______________________________________________
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to