[Zope-Checkins] CVS: Zope/lib/python/OFS - SimpleItem.py:1.108

Jim Fulton cvs-admin at zope.org
Fri Nov 28 11:45:42 EST 2003


Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv4944/lib/python/OFS

Modified Files:
	SimpleItem.py 
Log Message:
Changed call to no-longer-supported validateValue methos to use the
validate method instead.

Use new getRoles function to get object roles, rather than using
__roles__ attribute.


=== Zope/lib/python/OFS/SimpleItem.py 1.107 => 1.108 ===
--- Zope/lib/python/OFS/SimpleItem.py:1.107	Tue Nov 18 08:17:03 2003
+++ Zope/lib/python/OFS/SimpleItem.py	Fri Nov 28 11:45:42 2003
@@ -35,6 +35,7 @@
 from zExceptions import Redirect
 import time
 from zLOG import LOG, BLATHER
+from AccessControl.ZopeSecurityPolicy import getRoles
 
 import marshal
 import ZDOM
@@ -238,25 +239,32 @@
         from AccessControl.User import nobody
         mode=0100000
 
-        # check read permissions
-        if (hasattr(aq_base(self),'manage_FTPget') and
-            hasattr(self.manage_FTPget, '__roles__')):
+        if (hasattr(aq_base(self),'manage_FTPget')):
             try:
-                if getSecurityManager().validateValue(self.manage_FTPget):
+                if getSecurityManager().validate(
+                    None, self, 'manage_FTPget', self.manage_FTPget):
                     mode=mode | 0440
-            except: pass
-            if nobody.allowed(self.manage_FTPget,
-                              self.manage_FTPget.__roles__):
+            except Unauthorized:
+                pass
+            
+            if nobody.allowed(
+                self.manage_FTPget,
+                getRoles(self, 'manage_FTPget', self.manage_FTPget, ()),
+                ):
                 mode=mode | 0004
 
         # check write permissions
-        if hasattr(aq_base(self),'PUT') and hasattr(self.PUT, '__roles__'):
+        if hasattr(aq_base(self),'PUT'):
             try:
-                if getSecurityManager().validateValue(self.PUT):
+                if getSecurityManager().validate(None, self, 'PUT', self.PUT):
                     mode=mode | 0220
-            except: pass
+            except Unauthorized:
+                pass
 
-            if nobody.allowed(self.PUT, self.PUT.__roles__):
+            if nobody.allowed(
+                self.PUT,
+                getRoles(self, 'PUT', self.PUT, ()),
+                ):
                 mode=mode | 0002
 
         # get size




More information about the Zope-Checkins mailing list