[Zope-CVS] CVS: Packages/Moztop/moztopsupport - configure.zcml:1.2 interfaces.py:1.2 utilities.py:1.2
Sidnei da Silva
sidnei@x3ng.com.br
Fri, 21 Mar 2003 09:29:54 -0500
Update of /cvs-repository/Packages/Moztop/moztopsupport
In directory cvs.zope.org:/tmp/cvs-serv26388/moztopsupport
Modified Files:
configure.zcml interfaces.py utilities.py
Log Message:
A site *must* have a Local ServiceManager
=== Packages/Moztop/moztopsupport/configure.zcml 1.1 => 1.2 ===
--- Packages/Moztop/moztopsupport/configure.zcml:1.1 Thu Mar 20 13:24:26 2003
+++ Packages/Moztop/moztopsupport/configure.zcml Fri Mar 21 09:29:23 2003
@@ -14,4 +14,8 @@
permission="zope.Public"
provides=".interfaces.IResourceTypesUtility" />
+ <utility factory=".utilities.ServiceManagerUtility"
+ permission="zope.Public"
+ provides=".interfaces.IServiceManagerUtility" />
+
</zopeConfigure>
=== Packages/Moztop/moztopsupport/interfaces.py 1.1 => 1.2 ===
--- Packages/Moztop/moztopsupport/interfaces.py:1.1 Thu Mar 20 13:24:26 2003
+++ Packages/Moztop/moztopsupport/interfaces.py Fri Mar 21 09:29:23 2003
@@ -26,3 +26,11 @@
def getResourceTypeFor(obj):
""" Returns the resource type for a given object """
+
+class IServiceManagerUtility(Interface):
+ """ Utility to check if an object is a service manager
+ and contains a Local ServiceManager """
+
+ def hasLocalServiceManager(self, obj):
+ """ Asserts that obj has a Local ServiceManager """
+
=== Packages/Moztop/moztopsupport/utilities.py 1.1 => 1.2 ===
--- Packages/Moztop/moztopsupport/utilities.py:1.1 Thu Mar 20 13:24:26 2003
+++ Packages/Moztop/moztopsupport/utilities.py Fri Mar 21 09:29:23 2003
@@ -16,9 +16,10 @@
$Id$"""
from zope.app.content.folder import RootFolder
-from zope.component import getService
+from zope.app.interfaces.services.service import IServiceManagerContainer
+from zope.component import getService, queryAdapter
from zope.proxy.introspection import removeAllProxies
-from moztopsupport.interfaces import IResourceTypesUtility
+from moztopsupport.interfaces import IResourceTypesUtility, IServiceManagerUtility
class ResourceTypesUtility:
@@ -51,3 +52,12 @@
return name
return 'Unknown'
+class ServiceManagerUtility:
+
+ __implements__ = IServiceManagerUtility
+
+ def hasLocalServiceManager(self, object):
+ smc = queryAdapter(object, IServiceManagerContainer)
+ if smc is None:
+ return False
+ return smc.hasServiceManager()