从(现在已过时)自定义ATImage内容类型迁移 [英] Migrating from (now obsolete) custom ATImage content type

查看:98
本文介绍了从(现在已过时)自定义ATImage内容类型迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们收集了具有自定义图像类型的Plone 3网站的整个集合 从ATImage继承.这使我们可以为图像添加额外的图像缩放比例 标准列表(主题包使用的'logo':( 454,58)").

We had a whole collection of Plone 3 sites with a custom Image type subclassed from ATImage. This allowed us to add an extra image scaling to the standard list ("'logo':(454, 58)", used by our theme package).

虽然此方法在Plone 4中仍然有效,但实际上这不是正确的方法 plone.app.imaging是标准工具箱的一部分.可以在上面定义自定义比例 苍蝇.

While this still works in Plone 4, it isn't really the correct approach now that plone.app.imaging is part of the standard toolkit. That can define custom scales on the fly.

看起来我可以在子类的任何类型上启用plone.app.imaging 只需为自定义集合设置"sizes = None"即可从ATImage中获取 在类型上缩放.但是,我剩下了ATImage的冗余子类. 从长远来看,替换所有现有的"FalconImage"将很有用 内容项(总计数百个)和标准的图片"内容项.

It looks like I can enable plone.app.imaging on any type subclassed from ATImage by simply setting "sizes = None" for the collection of custom scales on the type. I am however then left with a redundant subclass of ATImage. Looking long term, it would be useful to replace all of our existing "FalconImage" content items (hundreds in total) with standard "Image" content items.

在测试站点上进行的简短实验表明,如果我只是浏览文档, 树,将portal_type属性从"FalconImage"更新为"Image",然后 内容表现为图片":每个对象突然获得一个 转换标签和@@ imaging-controlpanel定义的所有比例.

A brief experiment on a test site reveals that if I just walk through the document tree updating the portal_type attribute from "FalconImage" to "Image" then the content behaves as an "Image": each object suddenly acquires a Transform tab and all of the scales defined by @@imaging-controlpanel.

我敢肯定,这种蛮力方法会带来一些后果. 是否有推荐的方法可以将一种类型转换为另一种类型?

I am sure that there would be fallout from such a brute force approach. Is there a recommended approach for transforming one type into another?

(如果有人认为我很乐意为我们的自定义ATImage类型添加源 这是相关的.实际上,这只是对ATImage的非常细微的调整, ImageField上具有不同的尺寸集合)

(I'm happy to add source for our custom ATImage type if anyone thinks that it is relevant. It is really just a very minimal tweak of ATImage, with a different collection of sizes on the ImageField)

推荐答案

是的,有一种推荐的方法:

Yes, there is a recommended approach:

http://pypi.python.org/pypi/Products.contentmigration

唯一要做的就是编写从FalconImage到Image的自定义迁移.

The only thing that you have to do is to write a custom migration from FalconImage to Image.

再见, 贾科莫

这篇关于从(现在已过时)自定义ATImage内容类型迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆