Commit b104e7cb authored by Jean-Paul Smets's avatar Jean-Paul Smets

support of better renaming


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@977 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0839aa46
...@@ -1048,6 +1048,13 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -1048,6 +1048,13 @@ class CategoryTool( UniqueObject, Folder, Base ):
if requires_update: self._setCategoryList(context, tuple(categories)) if requires_update: self._setCategoryList(context, tuple(categories))
# Catalog related methods # Catalog related methods
def updateRelatedCategory(self, category, previous_category_url, new_category_url):
new_category = re.sub('(?P<start>.*)/%s/(?P<stop>.*)' %
previous_category_url,'\g<start>/%s/\g<stop>' % new_category_url,category)
new_category = re.sub('(?P<start>.*)/%s$' %
previous_category_url,'\g<start>/%s' % new_category_url, new_category)
return new_category
def updateRelatedContent(self, context, previous_category_url, new_category_url): def updateRelatedContent(self, context, previous_category_url, new_category_url):
""" """
TODO: make this method resist to very large updates (ie. long transaction) TODO: make this method resist to very large updates (ie. long transaction)
...@@ -1064,6 +1071,8 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -1064,6 +1071,8 @@ class CategoryTool( UniqueObject, Folder, Base ):
category_list += [new_category] category_list += [new_category]
#LOG('updateRelatedContent of %s' % o.getRelativeUrl(), 0, str(category_list)) #LOG('updateRelatedContent of %s' % o.getRelativeUrl(), 0, str(category_list))
self._setCategoryList(o, category_list) self._setCategoryList(o, category_list)
if hasattr(aq_base(o), 'notifyAfterUpdateRelatedContent'):
o.notifyAfterUpdateRelatedContent(previous_category_url, new_category_url)
else: else:
LOG('WARNING updateRelatedContent',0,'%s does not exist' % brain.path) LOG('WARNING updateRelatedContent',0,'%s does not exist' % brain.path)
aq_context = aq_base(context) aq_context = aq_base(context)
......
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