plonetransmogrifier

Easiest way to specify alternate transmogrifier _path?


I'm doing a content migration with collective.transmogrifier and I'm reading files off the file system with transmogrify.filesystem. Instead of importing the files "as is", I'd like to import them to a sub directory in Plone. What is the easiest way to modify the _path?

For example, if the following exists:

I'd like to import to:

In other words, import the contents of "baz" to a subdirectory "foo". I see two options:

Am I missing anything easier?


Solution

  • Use the standard inserter blueprint to generate the paths; it accepts python expressions and can replace keys in-place:

    [manglepath]
    blueprint = collective.transmogrifier.sections.inserter
    key = string:_path
    value = python:item['_path'].replace('/var/www/html', '/Plone/foo')
    

    This thus takes the output of the value python expression (which uses the item _path and stores it back under the same key.