[Erp5-report] r22381 - /erp5/trunk/products/CMFCategory/CategoryTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Jul 9 14:34:24 CEST 2008
Author: jp
Date: Wed Jul 9 14:34:24 2008
New Revision: 22381
URL: http://svn.erp5.org?rev=22381&view=rev
Log:
A hack to solve a problem related to acquisition of properties through parent in temp objects.
Modified:
erp5/trunk/products/CMFCategory/CategoryTool.py
Modified: erp5/trunk/products/CMFCategory/CategoryTool.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFCategory/CategoryTool.py?rev=22381&r1=22380&r2=22381&view=diff
==============================================================================
--- erp5/trunk/products/CMFCategory/CategoryTool.py (original)
+++ erp5/trunk/products/CMFCategory/CategoryTool.py Wed Jul 9 14:34:24 2008
@@ -43,6 +43,7 @@
from Products.CMFCore.PortalFolder import ContentFilter
from Products.CMFCategory.Renderer import Renderer
from OFS.Traversable import NotFound
+import types
import re
@@ -582,12 +583,8 @@
LOG('WARNING: CategoriesTool',0, 'Unable to find object for path %s' % path)
# We must include parent if specified explicitely
if 'parent' in category_list:
- parent = context.aq_parent
- if parent.portal_type in spec:
- if base:
- membership.append('parent/' + parent.getRelativeUrl())
- else:
- membership.append(parent.getRelativeUrl())
+ # Handle parent base category is a special way
+ membership.append(parent.getParentValue())
return membership
security.declareProtected( Permissions.AccessContentsInformation, 'setCategoryMembership' )
@@ -780,7 +777,6 @@
return category
else:
return None
-
# 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)))
@@ -1603,6 +1599,9 @@
Finds an object from a relative_url
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)
if cache is not None:
key = ('resolveCategory', relative_url)
@@ -1686,6 +1685,8 @@
# XXX Currently, resolveCategory accepts that a category might
# not start with a Base Category, but with a Module. This is
# probably wrong. For compatibility, this behavior is retained.
+ # JPS: I confirm that category should always start with a base
+ # category
obj = self
if stack:
portal = aq_inner(self.getPortalObject())
More information about the Erp5-report
mailing list