[Zope-Checkins] CVS: Zope2 - SimpleItem.py:1.87

Brian Lloyd brian@digicool.com
Tue, 3 Apr 2001 11:13:43 -0400 (EDT)


Update of /cvs-repository/Zope2/lib/python/OFS
In directory korak:/home/brian/temp/mainline_test/lib/python/OFS

Modified Files:
	SimpleItem.py 
Log Message:
Removed some assumptions about aquisition



--- Updated File SimpleItem.py in package Zope2 --
--- SimpleItem.py	2001/02/05 21:48:31	1.86
+++ SimpleItem.py	2001/04/03 15:13:42	1.87
@@ -103,6 +103,8 @@
 from ComputedAttribute import ComputedAttribute
 from AccessControl import getSecurityManager
 from Traversable import Traversable
+from Acquisition import aq_base
+import time
 
 import marshal
 import ZDOM
@@ -286,7 +288,7 @@
         mode=0100000
         
         # check read permissions
-        if (hasattr(self.aq_base,'manage_FTPget') and 
+        if (hasattr(aq_base(self),'manage_FTPget') and 
             hasattr(self.manage_FTPget, '__roles__')):
             try:
                 if getSecurityManager().validateValue(self.manage_FTPget):
@@ -297,7 +299,7 @@
                 mode=mode | 0004
                 
         # check write permissions
-        if hasattr(self.aq_base,'PUT') and hasattr(self.PUT, '__roles__'):
+        if hasattr(aq_base(self),'PUT') and hasattr(self.PUT, '__roles__'):
             try:
                 if getSecurityManager().validateValue(self.PUT):
                     mode=mode | 0220
@@ -314,13 +316,17 @@
         else:
             size=0
         # get modification time
-        mtime=self.bobobase_modification_time().timeTime()
+        if hasattr(aq_base(self), 'bobobase_modification_time'):
+            mtime=self.bobobase_modification_time().timeTime()
+        else:
+            mtime=time.time()
         # get owner and group
         owner=group='Zope'
-        for user, roles in self.get_local_roles():
-            if 'Owner' in roles:
-                owner=user
-                break
+        if hasattr(aq_base(self), 'get_local_roles'):
+            for user, roles in self.get_local_roles():
+                if 'Owner' in roles:
+                    owner=user
+                    break
         return marshal.dumps((mode,0,0,1,owner,group,size,mtime,mtime,mtime))
 
     def manage_FTPlist(self,REQUEST):