[Zope] Shallow copies/links/references
Joachim Werner
joe@iuveno-net.de
Wed, 8 Aug 2001 02:29:11 +0200
Hi!
I haven't tested your patch yet, but in theory it works fine for me. Though
it is quite a hack ;-)
Shane did something similar with his Symlik product, which still is on
zope.org, but not linked at any more. If you want to look at it: It's here:
http://www.zope.org/Members/hathawsh/Symlink
<disclaimer>WARNING: THIS IS NOT FOR USE IN PRODUCTION SYSTEMS!</disclaimer>
Shane's symlinks have the same conceptual problem you have: They look
exactly like the original objects. Your approach seems to be more
straightforward in terms of the user interface because it makes use of the
copy&paste, which is really cool.
I am currently working on more or less the same thing for Kontentor 2
(previews maybe next week!). I've implemented my own session-based copy
support (just stores the path of the object to copy, doesn't know about
multiple copy yet), because I didn't like the cookie thing. My "symlinks"
are real objects that just hold the path to the linked object. When called,
they do:
def __call__(self, mode='view', REQUEST=None):
''' '''
linkAsList = string.split(self.link, '/')
object = self.restrictedTraverse(linkAsList)
return object.__call__(REQUEST)
So when I edit the symlink, I don't get the original object, but just the
form to change the link path. But that's exactly what I want. It would be no
problem to add another edit link in the Kontentor frontend that opens the
original object instead.
Links to the references of an object are actually impossible without a major
hack. What I'll do instead is use the catalog to find all symlink objects
whose "link" attribute equals the absolute_url of the parent object. That
will do it for me.
In the newest SmartSections (which will be Kontentor's editing frontend),
you can copy and paste (or symlink-paste) objects (Headers, Images, Text
blocks, News items etc.) around in the site. Really cool. It will also get a
version-based editing and reviewing framework. I'm using versions because so
I can combine changes in more than one object to an actual review request
(which will, if approved, just commit the version). With CMF you can only
add one object at a time.
Cheers
Joachim