Commit 80c838ed authored by Jean-Paul Smets's avatar Jean-Paul Smets

A hack to solve a problem related to acquisition of properties through parent in temp objects.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22381 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e13b7503
...@@ -43,6 +43,7 @@ from Products.CMFCategory import _dtmldir ...@@ -43,6 +43,7 @@ from Products.CMFCategory import _dtmldir
from Products.CMFCore.PortalFolder import ContentFilter from Products.CMFCore.PortalFolder import ContentFilter
from Products.CMFCategory.Renderer import Renderer from Products.CMFCategory.Renderer import Renderer
from OFS.Traversable import NotFound from OFS.Traversable import NotFound
import types
import re import re
...@@ -582,12 +583,8 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -582,12 +583,8 @@ class CategoryTool( UniqueObject, Folder, Base ):
LOG('WARNING: CategoriesTool',0, 'Unable to find object for path %s' % path) LOG('WARNING: CategoriesTool',0, 'Unable to find object for path %s' % path)
# We must include parent if specified explicitely # We must include parent if specified explicitely
if 'parent' in category_list: if 'parent' in category_list:
parent = context.aq_parent # Handle parent base category is a special way
if parent.portal_type in spec: membership.append(parent.getParentValue())
if base:
membership.append('parent/' + parent.getRelativeUrl())
else:
membership.append(parent.getRelativeUrl())
return membership return membership
security.declareProtected( Permissions.AccessContentsInformation, 'setCategoryMembership' ) security.declareProtected( Permissions.AccessContentsInformation, 'setCategoryMembership' )
...@@ -780,7 +777,6 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -780,7 +777,6 @@ class CategoryTool( UniqueObject, Folder, Base ):
return category return category
else: else:
return None return None
# We must treat parent in a different way # We must treat parent in a different way
#LOG('getSingleCategoryMembershipList', 0, 'base_category = %s, spec = %s, base = %s, context = %s, context.aq_inner.aq_parent = %s' % (repr(base_category), repr(spec), repr(base), repr(context), repr(context.aq_inner.aq_parent))) #LOG('getSingleCategoryMembershipList', 0, 'base_category = %s, spec = %s, base = %s, context = %s, context.aq_inner.aq_parent = %s' % (repr(base_category), repr(spec), repr(base), repr(context), repr(context.aq_inner.aq_parent)))
...@@ -1603,6 +1599,9 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -1603,6 +1599,9 @@ class CategoryTool( UniqueObject, Folder, Base ):
Finds an object from a relative_url Finds an object from a relative_url
Method is public since we use restrictedTraverse Method is public since we use restrictedTraverse
""" """
if not isinstance(relative_url, str):
# Handle parent base category is a special way
return relative_url
cache = getReadOnlyTransactionCache(self) cache = getReadOnlyTransactionCache(self)
if cache is not None: if cache is not None:
key = ('resolveCategory', relative_url) key = ('resolveCategory', relative_url)
...@@ -1686,6 +1685,8 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -1686,6 +1685,8 @@ class CategoryTool( UniqueObject, Folder, Base ):
# XXX Currently, resolveCategory accepts that a category might # XXX Currently, resolveCategory accepts that a category might
# not start with a Base Category, but with a Module. This is # not start with a Base Category, but with a Module. This is
# probably wrong. For compatibility, this behavior is retained. # probably wrong. For compatibility, this behavior is retained.
# JPS: I confirm that category should always start with a base
# category
obj = self obj = self
if stack: if stack:
portal = aq_inner(self.getPortalObject()) portal = aq_inner(self.getPortalObject())
......
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