plonetransmogrifier

How to convert a string into a DateTime in a trasmogrifier step?


I need to convert a string into a DateTime during a trasmogrification. Something like this:

[set-startDate]
blueprint = collective.transmogrifier.sections.inserter
condition = python: item.has_key('startDate')
key = string:startDate
value = python: <conversion to DateTime>

How can I achieve this?


Solution

  • Looking at the doc of collective.transmogrifier, I've found my answer:

    [set-startDate]
    blueprint = collective.transmogrifier.sections.inserter
    condition = python: item.has_key('startDate')
    key = string:startDate
    value = python: modules['DateTime'].DateTime(item['startDate'])