Commit 3bf9012a authored by Alexandre Boeglin's avatar Alexandre Boeglin

This function generates "nice" title from the object's id.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1344 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9e31b651
import string
def fixMissingCategoryTitles(self):
"""
Recursively sets a default title when it's empty or equal to id
Must be called on CategoryTool
"""
for base in self.getChildNodes():
objectlist = base.getCategoryChildValueList()
for object in objectlist :
title = object.getTitle()
id = object.getId()
if len(title) == 0 or title is None or title == id :
new_title = string.capwords(id.replace('_', ' '))
setattr(object, 'title', new_title)
return 'done'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment