如何在trasmogrifier步骤中将字符串转换为DateTime?

时间:2011-11-10 16:56:24

标签: plone transmogrifier

我需要在trasmogrification期间将字符串转换为DateTime。像这样:

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

我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:2)

查看collective.transmogrifier的文档,我找到了答案:

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