Skip to content. | Skip to navigation

Personal tools


You are here: Home / Tips / Transmogrifier


內容型別的資料移植,通常有三種方式,一是將內容匯出成檔案再匯入,二是利用 JSON 資料來移植,三是利用 Funnelweb 來移植。

Plone 4.x 移植到 Plone 5.x 的建議流程: 順序上,目錄要先建立,內含項目才能移植成功。獨立於 Plone 環境 (不需要 CMFCore)

eggs +=

以 Plone 4.0.2 為例,安裝 psycopg2 (2.2.2) collective.transmogrifier (1.2) (1.1) transmogrify.sqlalchemy (1.0.1) SQLAlchemy (0.6.5)

以 Plone 4.0.7 為例,已內建 distribute 0.6.16 不需要在 buildout.cfg 指定,SQLAlchemy (0.7.1) collective.transmogrifier (1.3) psycopg2 (2.4.2)

依照 CSV 內容批次建立項目 JSON layout default page

source 支援的格式包括 CSV, SQL database 等,輸出的格式包括 plone.rfc822, z3c.schema2xml

path 使用 ASCII 編碼 UnicodeDecodeError

Default Page Name Assumption

Append Data to a Field Deserializer for DateTime Field

transmogrify.dexterity: CSV Import Pipeline, Prevent value-converters from failing for non-intids

協助開發過程的測試工作,利用 curl 工具,還可以把 ZMI 介面操作的步驟自動化。

transmogrify.ploneremote getPhysicalPath 缺 DocString

transmogrify.filesystem: Hints to Migrate News Items with Image Fields



transmogrify.htmlcontentextractor funnelweb

SixFeet Up Blog Migrating from Drupal: github code

wordpress2plone transmogrify.wordpress

├── my
│   ├──
│   └── migration
│       ├──
│       └── migration
│           ├──
│           ├── config
│           │   ├── articles.cfg
│           │   ├── base.cfg
│           │   ├── blogs.cfg
│           │   ├── comments.cfg
│           │   └── pages.cfg
│           ├── configure.zcml
│           └── profiles
│               └── default
│                   ├── metadata.xml
│                   └── transmogrifier.txt
├── setup.cfg

dexterity: look up an FTI for a portal type via queryUtility(IDexterityFTI, name=portal_type), and then get its schema via lookupSchema(), use that to figure out which fields to set (e.g. using setattr).

collective.jsonify collective.jsonmigrator

當系統過舊、無法安裝 transmogrify 可借助 collective.jsonifycollective.jsonmigrator。要先確認 simplejson 是否已經安裝:

$ bin/zopepy
>>> import simplejson
ImportError: No module named simplejson

把 collective.jsonify 安裝在來源網站,建立 <INSTANCE>/parts/instance/Extensions/ 內容如下:

from collective.jsonify import get_item
from collective.jsonify import get_children

建立兩個 External Method 對應:

Id: get_item
Method Name: json_methods
Function Name: get_item

把 collective.jsonmigrator 安裝在目的網站,從 /@@jsonmigrator 進入管理介面。必要的話,編輯 collective/jsonmigrator/<pipeline-name>.cfg 內容。通常也要重新執行 Catalog Build。

Development with transmogrify.dexterity



Funnelweb 需要提供 XPaths 給欄位: collections.OrderedDict ties to Python 2.7 example by Asko Soukka

Command Example existing folder file structure

$ bin/funnelweb

funnelweb: transmogrify.siteanalyser bug funnelweb.ttw example

Version 1.5 Workaround: adding auto-checkout += collective.transmogrifier (with mr.developer)


quintagroup.transmogrifier not aware of

pipeline processing issue

blueprint = quintagroup.transmogrifier.marshaller
exclude =

The set method in DataGridField expects a "value" parameter which is a list of dictionaries containing the grid fields.

利用 quintagroup.transmogrifier 來移植目錄資料,範例包括 simpleblog2quills

Content can be export/import directly to the FileSystem instead of building a "tar.gz" export using quintagroup.transmogrifier "context" attribute of the [reader] section.

Archetypes 與 Dexterity 對應

Accessor 與 Mutator


from plone.uuid.interfaces import ATTRIBUTE_NAME

setattr(obj, ATTRIBUTE_NAME, uuid)