[Erp5-report] r37452 fabien - /erp5/trunk/products/ERP5Type/Base.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Aug 3 17:49:03 CEST 2010


Author: fabien
Date: Tue Aug  3 17:49:01 2010
New Revision: 37452

URL: http://svn.erp5.org?rev=37452&view=rev
Log:
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

Modified:
    erp5/trunk/products/ERP5Type/Base.py

Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=37452&r1=37451&r2=37452&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Base.py [utf8] Tue Aug  3 17:49:01 2010
@@ -3382,6 +3382,9 @@ class Base( CopyContainer,
 
   security.declarePublic('isWebMode')
   def isWebMode(self):
+    """
+      return True if we are in web_mode and if editable_mode is NOT set
+    """
     if self.getApplicableLayout() is None:
       return False
     if getattr(self.REQUEST, 'ignore_layout', 0):
@@ -3390,6 +3393,19 @@ class Base( CopyContainer,
       return False
     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,
                             'updateLocalRolesOnSecurityGroups')
   def updateLocalRolesOnSecurityGroups(self, **kw):




More information about the Erp5-report mailing list