On Friday 08 February 2002 04:38 pm, you wrote:
Is there a way to create "symbolic links" in Zope either by editing ZMI code or programmatically? Let's say I want to create a "pointer" to a folder I have someplace. Is there a straightforward way to accomplish this? Here is a very descriptive graphical example (hahaha).
/[root folder] /myfolder1 +mygoodstuff /myfolder2 ->link_to_mygoodstuff
At 16:58 08-02-2002 -0500, Eron Lloyd wrote:
The most popular pattern for this is to do a <dtml-call expr="RESPONSE.redirect('/myfolder1/mygoodstuff')"> in a DTML method or Python script acting as a symlink. To my knowledge there is no way else out of the box to do this (though it would be interesting to implement).
Quite easily and simple, actually. Here's my take on it (from a previous message on the list. C U! -- Mario Valente At 19:04 07-08-2001 +0100, Mario Valente wrote:
Hi:
OK everyone, I've managed to get object links to work.
As discussed previously by others (re: object references) and asked by myself: I had the need to be able to refer to objects from different points of the folder hierarchy without duplicating those objects.
Yes I know that can be done *programatically*. That is not the idea.
The idea is to have a folder with differente widgets/components and to be able to copy and paste references to those widgets throughout the folder hierarchy. Of course that the usual copy/paste is not OK, since that *duplicates* the objects and as such further changes to the original object wont be reflected in the copies.
With something like this + Ordered Folders you are able to have an index_html that just renders the objects within a folder and you can then drop objects/widgets into the folder to produce a page.
What I did:
- edited CopySupport.py - copied the manage_pasteObjects method to a manage_pasteMonikers method - commented the #ob=ob._getCopy(self) line (the duplicate object part) - added a "Paste Ref" button to the lib/python/OFS/dtml/main.dtml file that calls the pasteMonikers method
""" <input class="form-element" type="submit"
name="manage_pasteMonikers:method"
value="Paste Ref." /> """
It works. It does what I want/need. When you change a reference, the original also changes. When you change the original, the references change. You can delete either the reference or the original and all is OK.
Issues/TODO
- find a way to distinguish references from the original (tried to change the meta_type at paste time but no luck). At least the meta_type/icon should change to provide a visual cue. - provide tool(s) to find impact of changing a reference. Provide a link from a reference object to the original. Provide a link from an object to its several references.
Comments and experiences are welcome.