Commit 556a2b2c authored by Alexandre Boeglin's avatar Alexandre Boeglin

Prevents getCategoryValue to return something else than a category,

or something outside the specified base_category.
To have a more permissive version, simply use (un)restrictedTraverse.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3257 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9c80a6cf
...@@ -200,10 +200,14 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -200,10 +200,14 @@ class CategoryTool( UniqueObject, Folder, Base ):
""" """
try: try:
relative_url = str(relative_url) relative_url = str(relative_url)
context = aq_base(self)
if base_category is not None: if base_category is not None:
relative_url = '%s/%s' % (base_category, relative_url) context = context.unrestrictedTraverse(base_category)
node = self.unrestrictedTraverse(relative_url) LOG('context base', 0, repr(context))
return node context = aq_base(context)
LOG('context', 0, repr(context))
node = context.unrestrictedTraverse(relative_url)
return node.__of__(self)
except: except:
return None return 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