设置调整内容创建、修改时间的脚本

设置调整内容创建、修改时间的脚本
通过ZMI将下面的python脚本文件添加到站点根:
 #set creationDate and effectiveDate to a given 
datedate="-".join(traverse_subpath)
 try:
     d= DateTime(date)
 except:
     return "problem with subpath '%s'. usage: setdate/YYYY/MM/DD" % date

 context.setModificationDate(date)
 context.setCreationDate(date)
 context.setEffectiveDate(date)
 context.reindexObject()

 return "date on '%s' successfully set to %s." % (context.title_or_id(), date)
如果是dexterity内容类型,将没用setCreationDate方法,应该直接设置creation_date属性。


设置