Is there something like a "symbolic link" (in *nixes terms) but for objects in ZODB in Plone?

432 views Asked by At

Suppose I have an object in /school1/document-rules.

Suppose in another context, /school2, I need to have the same document-rules that is available in /school1/document-rules.

In ZODB, having /school1/document-rules and /school2/document-rules means I have two different objects.

I would like to know if it's possible to make /school2/document-rules reference /school1/document-rules. So, /school2/document-rules would be something like a "ReferenceDocument", "ReferenceLink" or something like a symbolic link that would just point to /school1/document-rules.

Why? The document is the same, but sometimes it makes more sense (in semantic terms) to have the same document in different contexts. I have portlets that are rendered depending in their context, and I don't want to duplicate document-rules.

Does something like what I'm looking for exist? Bultin or using a module?

3

There are 3 answers

0
djay On BEST ANSWER

SimpleAlias does what you want. I've used it and it works well. You could also look at collective.alias

1
Danny Navarro On

ZODB handles references transparently as you would expect in plain Python. You have a nice explanation here.

You should watch out for multiple references for the same object when you want to delete the object. For that you might want to use weak references for your 'symlinks' using the weakref module from ZODB which is equivalent to weakref of the Python standard library.

0
ccrownhart On

I've used a product called RedirectionTool for this.