[Zope3-checkins] CVS: Zope3/src/zope/app/services - configuration.py:1.10 service.py:1.10 view.py:1.9
Guido van Rossum
guido@python.org
Mon, 10 Mar 2003 17:37:47 -0500
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv16722
Modified Files:
configuration.py service.py view.py
Log Message:
Add two new methods: usageSummary() and implementationSummary().
These are supposed to return two text lines summarizing the
configuration object. This will be used in the new configuration
manager default view shortly.
=== Zope3/src/zope/app/services/configuration.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/services/configuration.py:1.9 Fri Mar 7 11:44:49 2003
+++ Zope3/src/zope/app/services/configuration.py Mon Mar 10 17:37:47 2003
@@ -44,7 +44,7 @@
import Unregistered, Registered, Active
from zope.app.traversing \
- import getPhysicalRoot, getPhysicalPathString, traverse
+ import getPhysicalRoot, getPhysicalPathString, traverse, locationAsUnicode
class ConfigurationStatusProperty:
@@ -267,12 +267,22 @@
IAttributeAnnotatable,
)
+ # Methods from IConfiguration
+
def activated(self):
pass
def deactivated(self):
pass
+ def usageSummary(self):
+ return self.__class__.__name__
+
+ def implementationSummary(self):
+ return ""
+
+ # Methods from IDeleteNotifiable
+
def beforeDeleteHook(self, configuration, container):
"See IDeleteNotifiable"
@@ -299,6 +309,9 @@
self.name = name
super(NamedConfiguration, self).__init__()
+ def usageSummary(self):
+ return self.name + " " + self.__class__.__name__
+
class NamedComponentConfiguration(NamedConfiguration):
"""Named component configuration
@@ -317,6 +330,9 @@
permission = CheckerPublic
self.permission = permission
super(NamedComponentConfiguration, self).__init__(name)
+
+ def implementationSummary(self):
+ return locationAsUnicode(self.componentPath)
def getComponent(wrapped_self):
service_manager = getServiceManager(wrapped_self)
=== Zope3/src/zope/app/services/service.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/services/service.py:1.9 Mon Mar 3 18:16:13 2003
+++ Zope3/src/zope/app/services/service.py Mon Mar 10 17:37:47 2003
@@ -293,6 +293,9 @@
deactivated = ContextMethod(deactivated)
+ def usageSummary(self):
+ return self.name + " Service"
+
def afterAddHook(self, configuration, container):
NamedComponentConfiguration.afterAddHook(self,
configuration,
=== Zope3/src/zope/app/services/view.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/services/view.py:1.8 Mon Mar 3 18:16:13 2003
+++ Zope3/src/zope/app/services/view.py Mon Mar 10 17:37:47 2003
@@ -221,6 +221,8 @@
status = ConfigurationStatusProperty('Views')
+ _what = "View" # For usageSummary(); subclass may override
+
def __init__(self,
forInterface, viewName, presentationType,
class_, permission, layer='default'):
@@ -238,6 +240,13 @@
getView = ContextMethod(getView)
+ def usageSummary(self):
+ s = "%s %s for %s" % (self.viewName, self._what,
+ self.forInterface.__name__)
+ if self.layer and self.layer != "default":
+ s = "%s in layer %s" % (s, self.layer)
+ return s
+
class PageConfiguration(ViewConfiguration):
__implements__ = IPageConfiguration, ViewConfiguration.__implements__
@@ -245,6 +254,8 @@
# We only care about browser pages
presentationType = IBrowserPresentation
+ _what = "Page" # For usageSummary()
+
def __init__(self,
forInterface, viewName, permission,
class_=None, template=None, attribute=None,
@@ -256,6 +267,21 @@
self.template = template
self.attribute = attribute
+
+ def implementationSummary(self):
+ L = []
+ if self.template:
+ prefix = "/++etc++Services/Packages/"
+ t = self.template
+ i = t.rfind(prefix)
+ if i >= 0:
+ t = t[i + len(prefix):]
+ L.append("template=%s" % t)
+ if self.class_:
+ L.append("class=%s" % self.class_)
+ if self.attribute:
+ L.append("attribute=%s" % self.attribute)
+ return ", ".join(L)
def validate(self):
if self.template and self.attribute: