Commit 1dba237f authored by Romain Courteaud's avatar Romain Courteaud

Critical bug fix.

getCategoryValue must be able to return something else than Category.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3259 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b046f6dd
......@@ -200,14 +200,28 @@ class CategoryTool( UniqueObject, Folder, Base ):
"""
try:
relative_url = str(relative_url)
context = aq_base(self)
if base_category is not None:
context = context.unrestrictedTraverse(base_category)
context = aq_base(context)
node = context.unrestrictedTraverse(relative_url)
return node.__of__(self)
relative_url = '%s/%s' % (base_category, relative_url)
node = self.unrestrictedTraverse(relative_url)
return node
except:
return None
# security.declareProtected(Permissions.AccessContentsInformation, 'getCategoryValue')
# def getCategoryValue(self, relative_url, base_category = None):
# """
# Returns a Category object from a given category url
# and optionnal base category id
# """
# try:
# relative_url = str(relative_url)
# context = aq_base(self)
# if base_category is not None:
# context = context.unrestrictedTraverse(base_category)
# context = aq_base(context)
# node = context.unrestrictedTraverse(relative_url)
# return node.__of__(self)
# except:
# return None
security.declareProtected(Permissions.AccessContentsInformation, 'getCategoryUid')
def getCategoryUid(self, relative_url, base_category = None):
......
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