Commit 8e991385 authored by Julien Muchembled's avatar Julien Muchembled

Revert [29697] because such change needs to be discussed first


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29763 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 12c2e965
...@@ -1134,30 +1134,52 @@ def createExpressionContext(object, portal=None): ...@@ -1134,30 +1134,52 @@ def createExpressionContext(object, portal=None):
""" """
Return a context used for evaluating a TALES expression. Return a context used for evaluating a TALES expression.
""" """
if object is None: if portal is None and object is not None:
object_url = ''
else:
object_url = object.absolute_url()
if portal is None:
portal = object.getPortalObject() portal = object.getPortalObject()
if object is None or getattr(object, 'aq_base', None) is None:
folder = portal
else:
folder = object
# Search up the containment hierarchy until we find an
# object that claims it's a folder.
while folder is not None:
if getattr(aq_base(folder), 'isPrincipiaFolderish', 0):
# found it.
break
else:
folder = aq_parent(aq_inner(folder))
if portal is not None: if portal is not None:
portal_url = portal.absolute_url() pm = getToolByName(portal, 'portal_membership')
pm = portal.portal_membership
if pm.isAnonymousUser(): if pm.isAnonymousUser():
member = None member = None
else: else:
member = pm.getAuthenticatedMember() member = pm.getAuthenticatedMember()
else: else:
portal_url = ''
member = None member = None
if object is None:
object_url = ''
else:
object_url = object.absolute_url()
if folder is None:
folder_url = ''
else:
folder_url = folder.absolute_url()
if portal is None:
portal_url = ''
else:
portal_url = portal.absolute_url()
data = { data = {
'object_url': object_url, 'object_url': object_url,
'folder_url': folder_url,
'portal_url': portal_url, 'portal_url': portal_url,
'object': object, 'object': object,
'folder': None, # XXX to be removed when 'folder': folder,
# ERP5Type.Core.ActionInformation is cleaned up
'portal': portal, 'portal': portal,
'nothing': None, 'nothing': None,
'request': getattr( object, 'REQUEST', None ), 'request': getattr( object, 'REQUEST', 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