Commit e1ad7a33 authored by Fabien Morin's avatar Fabien Morin

isWebMode() depend on editable_mode so this make not possible to use same form

to view an object in web_mode using the condition object.isWebMode() on the action
view in the two following cases :
 - editable_mode:int=1
 - editable_mode:int=0

Now it's possible using a condition like
object.isWebMode() or object.isEditableMode()
-> this condition test web mode without caring about editable_mode

reviewed by JPS


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37452 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d91bfebb
...@@ -3382,6 +3382,9 @@ class Base( CopyContainer, ...@@ -3382,6 +3382,9 @@ class Base( CopyContainer,
security.declarePublic('isWebMode') security.declarePublic('isWebMode')
def isWebMode(self): def isWebMode(self):
"""
return True if we are in web_mode and if editable_mode is NOT set
"""
if self.getApplicableLayout() is None: if self.getApplicableLayout() is None:
return False return False
if getattr(self.REQUEST, 'ignore_layout', 0): if getattr(self.REQUEST, 'ignore_layout', 0):
...@@ -3390,6 +3393,19 @@ class Base( CopyContainer, ...@@ -3390,6 +3393,19 @@ class Base( CopyContainer,
return False return False
return True return True
security.declarePublic('isEditableWebMode')
def isEditableWebMode(self):
"""
return True if we are in web_mode and if editable_mode is set
"""
if self.getApplicableLayout() is None:
return False
if getattr(self.REQUEST, 'ignore_layout', 0):
return False
if not getattr(self.REQUEST, 'editable_mode', 1):
return False
return True
security.declareProtected(Permissions.ChangeLocalRoles, security.declareProtected(Permissions.ChangeLocalRoles,
'updateLocalRolesOnSecurityGroups') 'updateLocalRolesOnSecurityGroups')
def updateLocalRolesOnSecurityGroups(self, **kw): def updateLocalRolesOnSecurityGroups(self, **kw):
......
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