--- a/src/ztfy/utils/container.py Fri Aug 17 16:13:21 2012 +0200
+++ b/src/ztfy/utils/container.py Mon Aug 20 18:54:13 2012 +0200
@@ -23,13 +23,18 @@
# import Zope3 packages
# import local packages
+from ztfy.utils.unicode import translateString
-def getContentName(container, base_name):
+def getContentName(container, base_name, translate=True, max_length=30):
"""Get a real name for a given base name and a container
Target name will be suffixed with an index if base name already exists
"""
+ if translate:
+ base_name = translateString(base_name, spaces='-')
+ if max_length:
+ base_name = base_name[0:max_length]
if base_name not in container:
return base_name
index = 2