plone.app.blob 还是 z3c.blobfile?

发布于 2024-08-15 01:12:26 字数 421 浏览 4 评论 0原文

我需要一个 blob 文件字段作为 plone 中内容类型的一部分。 plone.app.blob 的 BlobField 应该提供此功能,但我找不到如何获取 URL 来下载包含原始文件名的文件(例如 http://plone.site/plone/obj/orig-file-name.avi)。有没有办法使用 plone.app.blob 来做到这一点?

或者,网上有一些指向 plone.namedfile 的指针来执行此操作。 plone.namedfile 似乎依赖于 z3c.blobfile。 z3c.blobfile 与 plone.app.blob 有何不同?

这些方法中的一种比另一种更好吗?

维克

I need a blob file field as part of a content type in plone. plone.app.blob's BlobField should provide this, but I can't find how to get a URL to download the file including the original filename (e.g. http://plone.site/plone/obj/orig-file-name.avi). Is there a way to do this using plone.app.blob?

Alternately, there are a few pointers on the web pointing to plone.namedfile to do this. plone.namedfile seems to rely on z3c.blobfile. How does z3c.blobfile differ from plone.app.blob?

Is one of these methods better than the other?

vik

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

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

发布评论

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

评论(1

合约呢 2024-08-22 01:12:26

如果您想使用原始文件名下载文件,则还需要一些部分:

  1. 确保将primary=True放入架构中的字段设置中。

  2. 确保内容类型的类子类为 plone.app.blob.content.ATBlob,它提供下载主字段的 index_html 方法。

  3. 确保将内容类型的 Portal_type 添加到 Portal_properties/site_properties 中的 typesUseViewActionInListings 列表。

plone.namedfile 提供了一个可与 z3c.form 库一起使用的文件字段。它确实基于 z3c.blobfile,它提供了与 zope.app.file 中的文件对象类似的接口。如果您正在构建基于原型的内容类型,这可能不是您想要的。

If you want to download the file using the original filename, you'll need a few more pieces:

  1. Make sure you put primary=True in the field's settings in the schema.

  2. Make sure your content type's class subclasses plone.app.blob.content.ATBlob, which provides an index_html method that downloads the primary field.

  3. Make sure you add your content type's portal_type to the typesUseViewActionInListings list in portal_properties/site_properties.

plone.namedfile provides a file field that can be used with the z3c.form library. It is indeed based on z3c.blobfile, which provides a similar interface to the file object from zope.app.file. This is probably not what you want if you're building an Archetypes-based content type.

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