是否有类似“符号链接”之类的东西? (用 *nixes 术语来说)但是对于 Plone 中 ZODB 中的对象?

发布于 2024-10-14 13:16:05 字数 679 浏览 9 评论 0原文

假设我在 /school1/document-rules 中有一个对象。

假设在另一个上下文中,/school2,我需要具有与 /school1/document-rules 中可用的相同的document-rules

在 ZODB 中,拥有 /school1/document-rules/school2/document-rules 意味着我有两个不同的对象。

我想知道是否可以制作 /school2/document-rules reference /school1/document-rules。因此,/school2/document-rules 将类似于“ReferenceDocument”、“ReferenceLink”或类似符号链接的内容,仅指向 /school1/document-rules

为什么?文档是相同的,但有时在不同的上下文中使用相同的文档更有意义(从语义角度来说)。我有根据其上下文呈现的 portlet,并且我不想重复 document-rules

是否存在像我正在寻找的东西?内置还是使用模块?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

在风中等你 2024-10-21 13:16:05

SimpleAlias 可以满足您的需求。我用过它并且效果很好。您还可以查看 collective.alias

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

千鲤 2024-10-21 13:16:05

ZODB 透明地处理引用,就像您在普通 Python 中所期望的那样。 这里有一个很好的解释。

当您想要删除某个对象时,应该注意同一对象的多个引用。为此,您可能希望使用 ZODB 的weakref 模块 相当于Python 标准库的weakref。

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.

诺曦 2024-10-21 13:16:05

为此,我使用了名为 RedirectionTool 的产品。

I've used a product called RedirectionTool for this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文