[Zope3-checkins] CVS: Zope3/src/zope/app/content - configure.zcml:1.28 folder.py:1.15

Jim Fulton jim at zope.com
Tue Sep 2 17:47:17 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/content
In directory cvs.zope.org:/tmp/cvs-serv16881/src/zope/app/content

Modified Files:
	configure.zcml folder.py 
Log Message:
Added ISite, which is a marker interface indicating that an object is
a site.

When an object is made into a site, ISite is declared for it.

Change to test whether something is a site by testing whether 
it (declares it) implements ISite.


=== Zope3/src/zope/app/content/configure.zcml 1.27 => 1.28 ===
--- Zope3/src/zope/app/content/configure.zcml:1.27	Thu Aug 21 10:19:22 2003
+++ Zope3/src/zope/app/content/configure.zcml	Tue Sep  2 16:46:46 2003
@@ -22,12 +22,12 @@
       description="Minimal folder" />
 
   <allow
-      interface="zope.app.interfaces.services.service.Read"
+      attributes="getSiteManager"
       />
 
   <require
       permission="zope.ManageServices"
-      interface="zope.app.interfaces.services.service.Write"
+      attributes="setSiteManager"
       />
 
   <require


=== Zope3/src/zope/app/content/folder.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/content/folder.py:1.14	Fri Aug 15 12:45:09 2003
+++ Zope3/src/zope/app/content/folder.py	Tue Sep  2 16:46:46 2003
@@ -15,8 +15,9 @@
 from persistence import Persistent
 from zodb.btrees.OOBTree import OOBTree
 from zope.app.content.fssync import DirectoryAdapter
-from zope.app.interfaces.content.folder import IFolder, IRootFolder, \
-     ICloneWithoutChildren
+from zope.app.interfaces.content.folder import ICloneWithoutChildren
+from zope.app.interfaces.content.folder import IFolder, IRootFolder
+from zope.app.interfaces.services.service import ISite
 from zope.app.services.servicecontainer import ServiceManagerContainer
 from zope.app.zapi import ContextWrapper
 from zope.exceptions import DuplicationError
@@ -128,13 +129,13 @@
 
     def keys(self):
         keys = self.context.keys()
-        if self.context.hasServiceManager():
+        if ISite.isImplementedBy(self.context):
             return list(keys) + ['++etc++site']
         return keys
 
     def get(self, key, default=None):
-        if key == '++etc++site' and self.context.hasServiceManager():
-            return self.context.getServiceManager()
+        if key == '++etc++site' and ISite.isImplementedBy(self.context):
+            return self.context.getSiteManager()
 
         return self.context.get(key, default)
 
@@ -152,7 +153,7 @@
 
     def __len__(self):
         l = len(self.context)
-        if self.context.hasServiceManager():
+        if ISite.isImplementedBy(self.context):
             l += 1
         return l
 
@@ -169,8 +170,8 @@
 
     def contents(self):
         result = super(FolderAdapter, self).contents()
-        if self.context.hasServiceManager():
-            sm = self.context.getServiceManager()
+        if ISite.isImplementedBy(self.context):
+            sm = self.context.getSiteManager()
             w = ContextWrapper(sm, self.context, name='++etc++site')
             result.append(('++etc++site', w))
         return result




More information about the Zope3-Checkins mailing list