I am trying to make a nice display of some objects using ZPT. These objects refer (by storing the path as a string) to other objects and I want to display an attribute of the referred-to object in the display.
What is the best design to achieve this? The following ZPT code works, but I highly doubt it is the best design :-) <td tal:content="python:here.restrictedTraverse(employee.department).title" />
Would it be best to write a python script that iterates over the actual objects creating a "mirror" object for each that contains the attributes to be displayed (without the intermediate references) and let the ZPT handle only the mirror objects?
That wouldn't be a bad idea, but maybe you can get the catalog to do it for you. One wants to avoid traversal when possible. It's expensive. Possibly also you could have your objects like 'employee' hold references instead of paths. I'm not sure how this interacts with persistence, but I imagine it would Just Work. --jcc