Commit 13702224 authored by Julien Muchembled's avatar Julien Muchembled

Fix 2 previous commits (r29391 & r29392)

* add docstring to new ERP5TypeInformation.getDefaultViewFor
* revert changes commited by mistake

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/portal_types@29401 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fdea9695
...@@ -120,22 +120,22 @@ class ActionInformation(XMLObject): ...@@ -120,22 +120,22 @@ class ActionInformation(XMLObject):
value = value and Expression(value) or None value = value and Expression(value) or None
self._baseSetIcon(value) self._baseSetIcon(value)
# def getAction(self): def getAction(self):
# """Overridden getter for 'action' to clean null values""" """Overridden getter for 'action' to clean null values"""
# if getattr(aq_base(self), 'action', None) == '': if getattr(aq_base(self), 'action', None) == '':
# del self.action del self.action
# return self._baseGetAction() return self._baseGetAction()
#
# def getCondition(self): def getCondition(self):
# """Overridden getter for 'condition' to clean null values""" """Overridden getter for 'condition' to clean null values"""
# if getattr(aq_base(self), 'condition', None) == '': if getattr(aq_base(self), 'condition', None) == '':
# del self.condition del self.condition
# return self._baseGetCondition() return self._baseGetCondition()
#
def getIcon(self): def getIcon(self):
"""Explicit getter for 'icon' to override DynamicType.getIcon from CMF""" """Overridden getter for 'icon' to clean null values"""
# if getattr(aq_base(self), 'icon', None) == '': if getattr(aq_base(self), 'icon', None) == '':
# del self.icon del self.icon
return self._baseGetIcon() return self._baseGetIcon()
security.declareProtected(AccessContentsInformation, 'getActionText') security.declareProtected(AccessContentsInformation, 'getActionText')
......
...@@ -488,6 +488,8 @@ class ERP5TypeInformation(XMLObject, ...@@ -488,6 +488,8 @@ class ERP5TypeInformation(XMLObject,
security.declarePrivate('getDefaultViewFor') security.declarePrivate('getDefaultViewFor')
def getDefaultViewFor(self, ob, view='view'): def getDefaultViewFor(self, ob, view='view'):
"""Return the object that renders the default view for the given object
"""
ec = createExpressionContext(ob) ec = createExpressionContext(ob)
best_action = (), None best_action = (), None
for action in self.getFilteredActionListFor(ob): for action in self.getFilteredActionListFor(ob):
...@@ -619,7 +621,7 @@ class ERP5TypeInformation(XMLObject, ...@@ -619,7 +621,7 @@ class ERP5TypeInformation(XMLObject,
action = ActionInformation(self.generateNewId()) action = ActionInformation(self.generateNewId())
for k, v in old_action.iteritems(): for k, v in old_action.iteritems():
if k in ('action', 'condition', 'icon'): if k in ('action', 'condition', 'icon'):
if not v or not v.text: if not v:
continue continue
v = v.__class__(v.text) v = v.__class__(v.text)
setattr(action, {'id': 'reference', setattr(action, {'id': 'reference',
......
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