[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services - bundle.pt:1.8.2.1 bundle.py:1.9.2.1 adapter.py:1.7.18.1 cache.py:1.9.12.1 cache.zcml:1.4.12.1 configure.zcml:1.51.12.1 connection.py:1.11.12.1 connection.zcml:1.6.12.1 field.py:1.7.16.1 service.py:1.25.12.1 serviceactivation.pt:1.6.12.1 view.py:1.15.10.1 view.zcml:1.2.12.1 views.pt:1.3.12.1 pagefolder_contents.pt:NONE sitemanagement_contents.pt:NONE
Grégoire Weber
zope@i-con.ch
Sun, 22 Jun 2003 10:24:16 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/services
In directory cvs.zope.org:/tmp/cvs-serv24874/src/zope/app/browser/services
Modified Files:
Tag: cw-mail-branch
adapter.py cache.py cache.zcml configure.zcml connection.py
connection.zcml field.py service.py serviceactivation.pt
view.py view.zcml views.pt
Added Files:
Tag: cw-mail-branch
bundle.pt bundle.py
Removed Files:
Tag: cw-mail-branch
pagefolder_contents.pt sitemanagement_contents.pt
Log Message:
Synced up with HEAD
=== Added File Zope3/src/zope/app/browser/services/bundle.pt ===
<html metal:use-macro="views/standard_macros/page">
<div metal:fill-slot="body" tal:define="message view/update">
<h1>Bundle Information</h1>
<h4>Services needed by this bundle</h4>
<ul>
<li tal:repeat="svc view/listServices">
<i tal:content="svc/service">Foo</i> service:
<span tal:condition="svc/insite">
present in site at
<a tal:content="svc/path" tal:attributes="href svc/path">/path</a>
</span>
<span tal:condition="not:svc/insite">
<span tal:condition="svc/inbundle">
configured in bundle at
<a tal:content="svc/inbundle"
tal:attributes="href svc/inbundle">path</a>
</span>
<span tal:condition="not:svc/inbundle">
<font size="+1" color="red">
<b>UNFULFILLED DEPENDENCY</b>
</font>
<br><b>(You must <a href="../default/AddService">add a
<i tal:content="svc/service">Foo</i>
service to this site</a> before you can activate this bundle)</b>
</span>
</span>
</li>
</ul>
<h4>Configurations in this bundle</h4>
<div class="message" tal:condition="message">
<span tal:replace="message">view/update message here</span>
<br><br><i><a href="@@bundle.html">(click to clear message)</a></i>
</div>
<form action="@@bundle.html" method="GET">
<tal:block tal:repeat="svc view/listServices">
<p>For <i tal:content="svc/service">Foo</i> service</p>
<ul>
<tal:block tal:repeat="cnf view/listConfigurations">
<li tal:condition="python: cnf['service'] == svc['service']"
tal:define="activate python:cnf['advice'] == 'Active'">
<a tal:attributes="href cnf/path">
<i tal:content="cnf/usage">Usage summary</i>
implemented by
<i tal:content="cnf/implementation">Implementation summary</i>
</a>
<span tal:condition="cnf/conflict">
<br>
<font color="red" tal:condition="not:activate">Conflicts
with</font>
<font color="green" tal:condition="activate">Overrides</font>
<a tal:content="cnf/conflict"
tal:attributes="href cnf/conflict">path</a>
</span>
<br>
<span tal:condition="python: cnf['advice'] == 'Active'">
<input type="radio" tal:attributes="name cnf/path"
value="Registered" />Register only
<b><input type="radio" tal:attributes="name cnf/path"
value="Active" checked />Register and activate</b>
</span>
<span tal:condition="python: cnf['advice'] == 'Registered'">
<b><input type="radio" tal:attributes="name cnf/path"
value="Registered" checked />Register only</b>
<input type="radio" tal:attributes="name cnf/path"
value="Active" />Register and activate
</span>
(is: <span tal:replace="cnf/status">Active</span>)
</li>
</tal:block>
</ul>
</tal:block>
<p>Click "Activate bundle" to perform the above actions.</p>
<p><input type="submit" value="Activate bundle" /></p>
<p><input type="reset" value="Reset form" /></p>
</form>
<form action="@@bundle.html" method="GET">
<p>Click "Deactivate bundle" to unregister all registrations in
this bundle.</p>
<p><input type="submit" value="Deactivate bundle" /></p>
<input type="hidden" name="allclear" value="1" />
</form>
</div>
</html>
=== Added File Zope3/src/zope/app/browser/services/bundle.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Bundle support.
(See also http://dev.zope.org/Zope3/ThroughTheWebSiteDevelopment .)
A (site-management) bundle is a (site-management) folder with special
status.
Eventually, bundles will be read-only, and the only thing you can do
with bundles is install and uninstall them. At installation time, a
bundle's dependencies and are analized and satisfied, and the
registrations in the bundle are activated, unless they conflict with
existing registrations. This is an interactive process.
XXX This interim code is much less ambitious: it just provides a view
on a (site-management) folder that displays all registrations in a
bundle and lets the user activate them.
$Id: bundle.py,v 1.9.2.1 2003/06/22 14:22:43 gregweb Exp $
"""
import re
from transaction import get_transaction
from zope.app import zapi
from zope.app.interfaces.container import IReadContainer
from zope.app.interfaces.services.registration import IRegistration
from zope.app.interfaces.services.registration import IRegistrationManager
from zope.app.interfaces.services.registration import RegisteredStatus
from zope.app.interfaces.services.registration import ActiveStatus
from zope.app.interfaces.services.registration import UnregisteredStatus
from zope.app.interfaces.services.folder import ISiteManagementFolder
from zope.app.interfaces.services.service import IServiceRegistration
from zope.component import ComponentLookupError
from zope.proxy import removeAllProxies
from zope.publisher.browser import BrowserView
class BundleView(BrowserView):
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
self.mypath = zapi.getPath(self.context)
self.myversion = self.parseVersion(self.mypath)
# Compute sitepath as the parent of mypath
sitepath = zapi.getPath(self.context)
i = sitepath.rfind("/")
if i > 0:
sitepath = sitepath[:i]
elif i == 0:
sitepath = "/"
else:
sitepath = ""
self.sitepath = sitepath
self.registrations = self.findRegistrations(self.context, "")
self.registrations.sort(self.compareRegistrations)
self.services = self.findServices()
# Methods called from the page template (bundle.pt)
def update(self):
if not self.request.form:
return
if zapi.getName(self.context) == "default":
# XXX This is not right: we should be able to tell bundles
# from non-bundles and only allow this command for
# bundles. The Bundle tab should only be present for
# bundles. But for now, we simply prevent the user from
# making a big mistake and changing the default folder.
return "ERROR: Won't change the default folder"
if "allclear" in self.request:
count = 0
for path, obj in self.registrations:
if obj.status != UnregisteredStatus:
obj.status = UnregisteredStatus
count += 1
if count:
get_transaction().note("deactivate bundle")
return "unregistered %d registrations" % count
activated = []
registered = []
for key, value in self.request.form.items():
if value not in (ActiveStatus, RegisteredStatus):
continue
for path, obj in self.registrations:
if key == path:
break
else:
raise ComponentLookupError(key)
for path, obj in self.registrations:
value = self.request.form.get(path)
if value not in (ActiveStatus, RegisteredStatus):
continue
if obj.status != value:
if value == ActiveStatus:
activated.append(path)
obj.status = ActiveStatus
else:
registered.append(path)
obj.status = RegisteredStatus
s = ""
if activated:
s += "Activated: %s.\n" % (", ".join(activated))
if registered:
s += "Registered: %s.\n" % (", ".join(registered))
if s:
get_transaction().note("activate bundle")
return s
def listServices(self):
infos = []
for name in self.services:
path, insite, inbundle = self.getServiceStatus(name)
d = {"service": name,
"path": path,
"insite": insite,
"inbundle": inbundle}
infos.append(d)
return infos
def listRegistrations(self):
infos = []
for path, obj in self.registrations:
name, advice, conflict = self.getAdvice(obj)
d = {"path": path,
"service": name,
"advice": advice,
"conflict": conflict,
"status": obj.status,
"usage": obj.usageSummary(),
"implementation": obj.implementationSummary()}
infos.append(d)
return infos
# The rest are helper methods
def getServiceStatus(self, name):
try:
svc = zapi.getService(self.context, name)
except:
svc = None
path = ""
insite = False
if svc:
try:
path = zapi.getPath(svc)
except:
pass
else:
insite = (path == self.sitepath or
path.startswith(self.sitepath + "/"))
inbundle = self.findServiceRegistration(name)
return path, insite, inbundle
def getAdvice(self, obj):
name = self.getServiceName(obj)
advice = ActiveStatus
conflict = ""
sm = zapi.getServiceManager(obj)
service = sm.queryLocalService(name)
if service:
registry = service.queryRegistrationsFor(obj)
if registry:
active = registry.active()
if active and active != obj:
conflict = zapi.getPath(active)
if not self.inOlderVersion(active):
advice = RegisteredStatus
return name, advice, conflict
def inOlderVersion(self, obj):
# Return whether obj (an active component) belongs to an older
# version of the same bundle we're proposing to activate here.
# XXX This assumes sites are named with ++etc++site; there is
# no support for the older ++etc++Services.
path = zapi.getPath(obj)
prefix = "/++etc++site/"
i = path.rfind(prefix) # (can the prefix occur twice?)
if i < 0:
return False
i += len(prefix) # points just after the second "/"
i = path.find("/", i) # finds next slash after that
if i >= 0:
path = path[:i]
# Now path is of the form ".../++etc++site/name-version"
version = self.parseVersion(path)
if not version:
return False
i = path.rfind("-") + 1
return self.mypath[:i] == path[:i] and self.myversion > version
nineDigits = re.compile(r"^\d{1,9}$")
def parseVersion(self, path):
# Return a list containing the version numbers, suitably
# modified for sane version comparison. If there is no
# version number, return None. A version number is any number
# of dot-separated integers of at most 9 digits, optionally
# followed by another dot and something like "a1" or "b1"
# indicating an alpha or beta version. If no alpha or beta
# version is present, "f" is assumed (indicating "final").
# ("f" is chosen to compare higher than "a1", "b1" or "c1" but
# lower than "p1"; "p1" is sometimes used to indicate a patch
# release.) Examples:
#
# "/foo/bar-boo" -> None
# "/foo/bar-boo-1.0" -> ["f000000001", "f000000000", "f"]
# "/foo/bar-boo-1.0.f" -> ["f000000001", "f000000000", "f"]
# "/foo/bar-boo-1.0.a1" -> ["f000000001", "f000000000", "a1"]
#
# Note that we do a string compare on the alpha/beta version
# number; "a10" will compare less than "a2". OTOH, the
# integers are padded with leading zeros, so "10" will compare
# higher than "2".
i = path.rfind("/") + 1
base = path[i:]
i = base.rfind("-") + 1
if not i:
return None # No version
version = base[i:]
parts = version.split(".")
last = parts[-1]
if self.nineDigits.match(last):
last = "f"
else:
last = last.lower()
del parts[-1]
if not parts:
return None
for i in range(len(parts)):
p = parts[i]
if not self.nineDigits.match(p):
return None
parts[i] = "f" + "0"*(9-len(p)) + p
parts.append(last)
return parts
def findServiceRegistration(self, name):
for path, obj in self.registrations:
if IServiceRegistration.isImplementedBy(obj):
if obj.name == name:
return path
return None
def findRegistrations(self, f, prefix):
alist = []
for name, obj in f.items():
if IRegistration.isImplementedBy(obj):
alist.append((prefix+name, obj))
elif IReadContainer.isImplementedBy(obj):
alist.extend(self.findRegistrations(obj, prefix+name+"/"))
return alist
def compareRegistrations(self, c1, c2):
path1, obj1 = c1
path2, obj2 = c2
t1 = (self.getAdjustedServiceName(obj1),
obj1.usageSummary(),
obj1.implementationSummary())
t2 = (self.getAdjustedServiceName(obj2),
obj2.usageSummary(),
obj2.implementationSummary())
return cmp(t1, t2)
def findServices(self):
sd = {}
for path, obj in self.registrations:
sd[self.getServiceName(obj)] = 1
services = sd.keys()
services.sort(self.compareServiceNames)
return services
def compareServiceNames(self, n1, n2):
return cmp(self.adjustServiceName(n1), self.adjustServiceName(n2))
def getAdjustedServiceName(self, registration):
name = self.getServiceName(registration)
return self.adjustServiceName(name)
def adjustServiceName(self, name):
# XXX Strange... There's no symbol for it in servicenames.py
if name == "Services":
return ""
else:
return name
def getServiceName(self, registration):
# Return the service associated with a registration.
return registration.serviceType
=== Zope3/src/zope/app/browser/services/adapter.py 1.7 => 1.7.18.1 ===
--- Zope3/src/zope/app/browser/services/adapter.py:1.7 Tue Mar 11 11:10:50 2003
+++ Zope3/src/zope/app/browser/services/adapter.py Sun Jun 22 10:22:43 2003
@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Views for local adapter configuration.
+"""Views for local adapter registration.
AdapterSeviceView -- it's a bit different from other services, as it
has a lot of things in it, so we provide a search interface:
@@ -19,7 +19,7 @@
search page
browsing page
- AdapterConfigurationAdd
+ AdapterRegistrationAdd
$Id$
"""
@@ -31,16 +31,16 @@
from zope.schema import getFieldNamesInOrder
from zope.component import getView
from zope.publisher.browser import BrowserView
-from zope.proxy.context import ContextWrapper
+from zope.app.context import ContextWrapper
-from zope.app.interfaces.services.adapter import IAdapterConfiguration
-from zope.app.interfaces.services.adapter import IAdapterConfigurationInfo
-from zope.app.interfaces.services.configuration import IConfiguration
+from zope.app.interfaces.services.adapter import IAdapterRegistration
+from zope.app.interfaces.services.adapter import IAdapterRegistrationInfo
+from zope.app.interfaces.services.registration import IRegistration
from zope.app.form.utility import setUpWidgets, getWidgetsData
from zope.app.form.utility import getWidgetsDataForContent
from zope.app.event import publish
from zope.app.event.objectevent import ObjectCreatedEvent
-from zope.app.services.adapter import AdapterConfiguration
+from zope.app.services.adapter import AdapterRegistration
from zope.app.component.interfacefield import InterfaceField
class IAdapterSearch(Interface):
@@ -60,8 +60,8 @@
setUpWidgets(self, IAdapterSearch)
def configInfo(self):
- forInterface = self.forInterface.getData()
- providedInterface = self.providedInterface.getData()
+ forInterface = self.forInterface_widget.getData()
+ providedInterface = self.providedInterface_widget.getData()
result = []
@@ -74,7 +74,7 @@
providedInterface.__module__ +"."+ providedInterface.__name__)
registry = ContextWrapper(registry, self.context)
- view = getView(registry, "ChangeConfigurations", self.request)
+ view = getView(registry, "ChangeRegistrations", self.request)
prefix = md5.new('%s %s' %
(forInterface, providedInterface)).hexdigest()
view.setPrefix(prefix)
@@ -88,19 +88,19 @@
return result
-class AdapterConfigurationAdd(BrowserView):
+class AdapterRegistrationAdd(BrowserView):
def __init__(self, *args):
- super(AdapterConfigurationAdd, self).__init__(*args)
- setUpWidgets(self, IAdapterConfiguration)
+ super(AdapterRegistrationAdd, self).__init__(*args)
+ setUpWidgets(self, IAdapterRegistration)
def refresh(self):
if "FINISH" in self.request:
- data = getWidgetsData(self, IAdapterConfigurationInfo, strict=True)
- configuration = AdapterConfiguration(**data)
- publish(self.context.context, ObjectCreatedEvent(configuration))
- configuration = self.context.add(configuration)
- getWidgetsDataForContent(self, IConfiguration, configuration,
+ data = getWidgetsData(self, IAdapterRegistrationInfo, strict=True)
+ registration = AdapterRegistration(**data)
+ publish(self.context.context, ObjectCreatedEvent(registration))
+ registration = self.context.add(registration)
+ getWidgetsDataForContent(self, IRegistration, registration,
strict=False)
self.request.response.redirect(self.context.nextURL())
return False
@@ -109,8 +109,8 @@
def getWidgets(self):
return ([getattr(self, name)
- for name in getFieldNamesInOrder(IAdapterConfigurationInfo)]
+ for name in getFieldNamesInOrder(IAdapterRegistrationInfo)]
+
[getattr(self, name)
- for name in getFieldNamesInOrder(IConfiguration)]
+ for name in getFieldNamesInOrder(IRegistration)]
)
=== Zope3/src/zope/app/browser/services/cache.py 1.9 => 1.9.12.1 ===
--- Zope3/src/zope/app/browser/services/cache.py:1.9 Thu May 1 12:28:28 2003
+++ Zope3/src/zope/app/browser/services/cache.py Sun Jun 22 10:22:43 2003
@@ -11,19 +11,20 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Cache configuration support classes.
+"""Cache registry support classes.
$Id$
"""
-from zope.app.browser.services.configuration import AddComponentConfiguration
+from zope.app.browser.services.registration import AddComponentRegistration
from zope.app.interfaces.container import IZopeContainer
-from zope.app.interfaces.services.configuration import IUseConfiguration
+from zope.app.interfaces.services.registration import IRegistered
from zope.component import getAdapter, getView
from zope.publisher.browser import BrowserView
-from zope.app.interfaces.services.configuration \
- import Unregistered, Registered, Active
-from zope.app.traversing import traverse, getPath, getParent, objectName
+from zope.app.interfaces.services.registration import ActiveStatus
+from zope.app.interfaces.services.registration import RegisteredStatus
+from zope.app.interfaces.services.registration import UnregisteredStatus
+from zope.app.traversing import traverse, getPath, getParent, getName
class Caches(BrowserView):
@@ -52,12 +53,12 @@
def _activate(self, todo):
done = []
for name in todo:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
obj = registry.active()
if obj is None:
- # Activate the first registered configuration
- obj = registry.info()[0]['configuration']
- obj.status = Active
+ # Activate the first registered registration
+ obj = registry.info()[0]['registration']
+ obj.status = ActiveStatus
done.append(name)
if done:
return "Activated: " + ", ".join(done)
@@ -67,10 +68,10 @@
def _deactivate(self, todo):
done = []
for name in todo:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
obj = registry.active()
if obj is not None:
- obj.status = Registered
+ obj.status = RegisteredStatus
done.append(name)
if done:
return "Deactivated: " + ", ".join(done)
@@ -80,7 +81,7 @@
def _delete(self, todo):
errors = []
for name in todo:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
assert registry
if registry.active() is not None:
errors.append(name)
@@ -93,24 +94,24 @@
# 1) Delete the registrations
caches = {}
for name in todo:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
assert registry
assert registry.active() is None # Phase error
for info in registry.info():
- conf = info['configuration']
+ conf = info['registration']
obj = conf.getComponent()
path = getPath(obj)
caches[path] = obj
- conf.status = Unregistered
+ conf.status = UnregisteredStatus
parent = getParent(conf)
- name = objectName(conf)
+ name = getName(conf)
container = getAdapter(parent, IZopeContainer)
del container[name]
# 2) Delete the cache objects
for path, obj in caches.items():
parent = getParent(obj)
- name = objectName(obj)
+ name = getName(obj)
container = getAdapter(parent, IZopeContainer)
del container[name]
@@ -118,8 +119,8 @@
def getConfigs(self):
L = []
- for name in self.context.listConfigurationNames():
- cr = self.context.queryConfigurations(name)
+ for name in self.context.listRegistrationNames():
+ cr = self.context.queryRegistrations(name)
active = cr.active()
d = {"name": name,
"url": "",
@@ -136,19 +137,19 @@
class ConfigureCache(BrowserView):
def update(self):
- cr = self.context.queryConfigurations(self.request['name'])
- form = getView(cr, "ChangeConfigurations", self.request)
+ cr = self.context.queryRegistrations(self.request['name'])
+ form = getView(cr, "ChangeRegistrations", self.request)
form.update()
return form
-class UseConfiguration(BrowserView):
+class Registered(BrowserView):
- """View for displaying the configurations for a cache."""
+ """View for displaying the registrations for a cache."""
def uses(self):
- """Get a sequence of configuration summaries."""
+ """Get a sequence of registration summaries."""
component = self.context
- useconfig = getAdapter(component, IUseConfiguration)
+ useconfig = getAdapter(component, IRegistered)
result = []
for path in useconfig.usages():
config = traverse(component, path)
@@ -160,6 +161,6 @@
})
return result
-class AddCacheConfiguration(AddComponentConfiguration):
+class AddCacheRegistration(AddComponentRegistration):
pass
=== Zope3/src/zope/app/browser/services/cache.zcml 1.4 => 1.4.12.1 ===
--- Zope3/src/zope/app/browser/services/cache.zcml:1.4 Mon Apr 28 11:54:10 2003
+++ Zope3/src/zope/app/browser/services/cache.zcml Sun Jun 22 10:22:43 2003
@@ -28,9 +28,9 @@
<!-- Configuration page for cache objects. You get here by
clicking on the (configure) link for a particular cache
in the "Caches" tab of the cache service. It shows
- a menu of different configurations, at most one of which
- is active. You can activate a different configuration, or
- click on an individual configuration to edit it.
+ a menu of different registrations, at most one of which
+ is active. You can activate a different registration, or
+ click on an individual registration to edit it.
(Note that this page doesn't really apply to a single cache,
it applies to a single cache name. -->
<page
@@ -46,13 +46,13 @@
an interface, a permission, and a registration status
(Unregistered, Registered or Active). -->
<addform
- label="New Cache Configuration"
+ label="New Cache Registration"
for="zope.app.interfaces.cache.cache.ICache"
- name="addConfiguration.html"
- schema="zope.app.interfaces.services.cache.ICacheConfiguration"
- class=".cache.AddCacheConfiguration"
+ name="addRegistration.html"
+ schema="zope.app.interfaces.services.cache.ICacheRegistration"
+ class=".cache.AddCacheRegistration"
permission="zope.ManageServices"
- content_factory="zope.app.services.cache.CacheConfiguration"
+ content_factory="zope.app.services.cache.CacheRegistration"
arguments="name componentPath"
set_after_add="status"
fields="name componentPath permission status"
=== Zope3/src/zope/app/browser/services/configure.zcml 1.51 => 1.51.12.1 ===
--- Zope3/src/zope/app/browser/services/configure.zcml:1.51 Wed Apr 30 18:06:31 2003
+++ Zope3/src/zope/app/browser/services/configure.zcml Sun Jun 22 10:22:43 2003
@@ -11,7 +11,7 @@
allowed_interface="zope.publisher.interfaces.browser.IBrowserPublisher"
/>
-<!-- General configuration views --> <include package=".configuration" />
+<!-- General registration views --> <include package=".registration" />
<!--Error Logging Service -->
@@ -196,7 +196,7 @@
<!-- Adapters -->
<editform
- schema="zope.app.interfaces.services.adapter.IAdapterConfiguration"
+ schema="zope.app.interfaces.services.adapter.IAdapterRegistration"
name="index.html"
menu="zmi_views"
label="Change adapter"
@@ -213,9 +213,9 @@
<view
for = "zope.app.interfaces.container.IAdding"
- name="AdapterConfiguration"
+ name="AdapterRegistration"
permission="zope.ManageServices"
- class="zope.app.browser.services.adapter.AdapterConfigurationAdd"
+ class="zope.app.browser.services.adapter.AdapterRegistrationAdd"
>
<page
name="index.html"
@@ -225,8 +225,8 @@
<menuItem
for="zope.app.interfaces.container.IAdding"
- menu="add_configuration"
- action="AdapterConfiguration"
+ menu="add_registration"
+ action="AdapterRegistration"
title="Adapter"
/>
@@ -331,31 +331,23 @@
/>
</menuItems>
- <pages
+ <page
+ name="contents.html"
for="zope.app.interfaces.services.service.IServiceManager"
+ menu="zmi_views" title="Contents"
permission="zope.ManageServices"
- class="zope.app.browser.services.service.SiteManagementFoldersContents">
-
- <page name="contents.html"
- attribute="index"
- menu="zmi_views" title="Contents"
- />
- <page name="addSiteManagementFolder.html"
- attribute="addSiteManagementFolder"
- />
- <page name="removeObjects.html"
- attribute="removeObjects"
- />
- </pages>
-
+ class="zope.app.browser.container.contents.Contents"
+ attribute="contents"
+ />
- <!-- Disable the add action -->
+ <!-- Override the add action with a link to add a page folder -->
<menuItem
menu="zmi_actions"
for="zope.app.interfaces.services.service.IServiceManager"
title="Add"
- action="@@contents.html"
- filter="nothing"
+ action=
+ "@@contents.html?type_name=zope.app.services.folder.SiteManagementFolder"
+ permission="zope.ManageServices"
/>
<pages
@@ -369,27 +361,21 @@
<!-- SiteManagementFolder -->
- <pages
+ <page
for="zope.app.interfaces.services.folder.ISiteManagementFolder"
permission="zope.ManageServices"
- class="zope.app.browser.container.contents.JustContents">
-
- <page name="index.html" attribute="index" />
-
- </pages>
+ class="zope.app.browser.container.contents.JustContents"
+ name="index.html" attribute="index"
+ />
- <pages
+ <page
+ name="contents.html"
for="zope.app.interfaces.services.folder.ISiteManagementFolder"
+ menu="zmi_views" title="Contents"
permission="zope.ManageServices"
class="zope.app.browser.container.contents.Contents"
- >
-
- <page name="contents.html"
- attribute="contents"
- menu="zmi_views" title="Contents"
- />
- <page name="removeObjects.html" attribute="removeObjects" />
- </pages>
+ attribute="contents"
+ />
<view
name="+"
@@ -406,21 +392,21 @@
<!-- Generic page for objects that keep track of their registrations -->
<page
- for="zope.app.interfaces.services.configuration.IUseConfigurable"
+ for="zope.app.interfaces.services.registration.IRegisterable"
name="registrations.html"
- template="configuration/useconfiguration.pt"
- class=".configuration.NameUseConfiguration"
+ template="registration/registered.pt"
+ class=".registration.NameRegistered"
permission="zope.ManageServices"
menu="zmi_views" title="Registrations"
/>
-<!-- ServiceConfiguration -->
+<!-- ServiceRegistration -->
<page
- name="addConfiguration.html"
+ name="addRegistration.html"
for="zope.app.interfaces.services.service.ILocalService"
template="add_svc_config.pt"
- class=".service.AddServiceConfiguration"
+ class=".service.AddServiceRegistration"
permission="zope.ManageServices"
/>
@@ -428,7 +414,7 @@
name="add_svc_config.html"
for="zope.app.interfaces.services.service.ILocalService"
attribute="action"
- class=".service.AddServiceConfiguration"
+ class=".service.AddServiceRegistration"
permission="zope.ManageServices"
/>
@@ -461,54 +447,40 @@
<!-- PageFolder -->
- <pages
+ <page
+ name="index.html"
for="zope.app.interfaces.services.pagefolder.IPageFolder"
permission="zope.ManageServices"
- class="zope.app.browser.container.contents.JustContents">
-
- <page name="index.html" attribute="index" />
-
- </pages>
+ class="zope.app.browser.container.contents.JustContents"
+ attribute="index"
+ />
- <pages
+ <page
for="zope.app.interfaces.services.pagefolder.IPageFolder"
permission="zope.ManageServices"
- class="zope.app.browser.services.pagefolder.PageFolderContents"
- >
-
- <page name="contents.html"
- attribute="index"
- />
- <page name="add.html"
- attribute="add"
- />
- <page name="removeObjects.html"
- attribute="removeObjects"
- />
- </pages>
+ class="zope.app.browser.container.contents.Contents"
+ name="contents.html"
+ menu="zmi_views"
+ title="Contents"
+ attribute="contents"
+ />
<editform
schema="zope.app.interfaces.services.pagefolder.IPageFolderInfo."
- name="DefaultConfiguration.html"
- menu="zmi_views" title="Default Configuration"
+ name="DefaultRegistration.html"
+ menu="zmi_views" title="Default Registration"
permission="zope.ManageServices"
- label="Default configuration parameters"
+ label="Default registration parameters"
/>
+
+ <!-- Override the add action with a link to add a template -->
<menuItem
menu="zmi_actions"
for="zope.app.interfaces.services.pagefolder.IPageFolder"
title="Add"
- action="."
- filter="nothing"
- />
-
- <menuItem
- menu="zmi_views"
- for="zope.app.interfaces.services.pagefolder.IPageFolder"
- title="Contents"
- action="@@contents.html"
- filter="context/configured"
+ action="contents.html?type_name=zope.app.services.zpt.template"
+ permission="zope.ManageServices"
/>
<menuItem
@@ -624,6 +596,18 @@
</view>
+
+<!-- Bundles -->
+
+ <page
+ name="bundle.html"
+ for="zope.app.interfaces.services.folder.ISiteManagementFolder"
+ menu="zmi_views" title="Bundle"
+ permission="zope.ManageServices"
+ class=".bundle.BundleView"
+ template="bundle.pt"
+ />
+
<!-- Translation Service Views -->
<include package=".translation" />
=== Zope3/src/zope/app/browser/services/connection.py 1.11 => 1.11.12.1 ===
--- Zope3/src/zope/app/browser/services/connection.py:1.11 Thu May 1 12:28:28 2003
+++ Zope3/src/zope/app/browser/services/connection.py Sun Jun 22 10:22:43 2003
@@ -11,19 +11,20 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Connection configuration support classes.
+"""Connection registry support classes.
$Id$
"""
-from zope.app.browser.services.configuration import AddComponentConfiguration
+from zope.app.browser.services.registration import AddComponentRegistration
from zope.app.interfaces.container import IZopeContainer
-from zope.app.interfaces.services.configuration import IUseConfiguration
+from zope.app.interfaces.services.registration import IRegistered
from zope.component import getAdapter, getView
from zope.publisher.browser import BrowserView
-from zope.app.interfaces.services.configuration \
- import Unregistered, Registered, Active
-from zope.app.traversing import traverse, getPath, getParent, objectName
+from zope.app.interfaces.services.registration import ActiveStatus
+from zope.app.interfaces.services.registration import RegisteredStatus
+from zope.app.interfaces.services.registration import UnregisteredStatus
+from zope.app.traversing import traverse, getPath, getParent, getName
class Connections(BrowserView):
@@ -52,12 +53,12 @@
def _activate(self, todo):
done = []
for name in todo:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
obj = registry.active()
if obj is None:
- # Activate the first registered configuration
- obj = registry.info()[0]['configuration']
- obj.status = Active
+ # Activate the first registered registration
+ obj = registry.info()[0]['registration']
+ obj.status = ActiveStatus
done.append(name)
if done:
return "Activated: " + ", ".join(done)
@@ -67,10 +68,10 @@
def _deactivate(self, todo):
done = []
for name in todo:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
obj = registry.active()
if obj is not None:
- obj.status = Registered
+ obj.status = RegisteredStatus
done.append(name)
if done:
return "Deactivated: " + ", ".join(done)
@@ -80,7 +81,7 @@
def _delete(self, todo):
errors = []
for name in todo:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
assert registry
if registry.active() is not None:
errors.append(name)
@@ -93,24 +94,24 @@
# 1) Delete the registrations
connections = {}
for name in todo:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
assert registry
assert registry.active() is None # Phase error
for info in registry.info():
- conf = info['configuration']
+ conf = info['registration']
obj = conf.getComponent()
path = getPath(obj)
connections[path] = obj
- conf.status = Unregistered
+ conf.status = UnregisteredStatus
parent = getParent(conf)
- name = objectName(conf)
+ name = getName(conf)
container = getAdapter(parent, IZopeContainer)
del container[name]
# 2) Delete the connection objects
for path, obj in connections.items():
parent = getParent(obj)
- name = objectName(obj)
+ name = getName(obj)
container = getAdapter(parent, IZopeContainer)
del container[name]
@@ -118,8 +119,8 @@
def getConfigs(self):
L = []
- for name in self.context.listConfigurationNames():
- cr = self.context.queryConfigurations(name)
+ for name in self.context.listRegistrationNames():
+ cr = self.context.queryRegistrations(name)
active = cr.active()
d = {"name": name,
"url": "",
@@ -136,19 +137,19 @@
class ConfigureConnection(BrowserView):
def update(self):
- cr = self.context.queryConfigurations(self.request['name'])
- form = getView(cr, "ChangeConfigurations", self.request)
+ cr = self.context.queryRegistrations(self.request['name'])
+ form = getView(cr, "ChangeRegistrations", self.request)
form.update()
return form
-class UseConfiguration(BrowserView):
+class Registered(BrowserView):
- """View for displaying the configurations for a connection."""
+ """View for displaying the registrations for a connection."""
def uses(self):
- """Get a sequence of configuration summaries."""
+ """Get a sequence of registration summaries."""
component = self.context
- useconfig = getAdapter(component, IUseConfiguration)
+ useconfig = getAdapter(component, IRegistered)
result = []
for path in useconfig.usages():
config = traverse(component, path)
@@ -160,6 +161,6 @@
})
return result
-class AddConnectionConfiguration(AddComponentConfiguration):
+class AddConnectionRegistration(AddComponentRegistration):
pass
=== Zope3/src/zope/app/browser/services/connection.zcml 1.6 => 1.6.12.1 ===
--- Zope3/src/zope/app/browser/services/connection.zcml:1.6 Wed Apr 30 15:16:27 2003
+++ Zope3/src/zope/app/browser/services/connection.zcml Sun Jun 22 10:22:43 2003
@@ -48,11 +48,11 @@
<addform
label="New Connection Registration"
for="zope.app.interfaces.rdb.IZopeDatabaseAdapter"
- name="addConfiguration.html"
- schema="zope.app.interfaces.services.connection.IConnectionConfiguration"
- class=".connection.AddConnectionConfiguration"
+ name="addRegistration.html"
+ schema="zope.app.interfaces.services.connection.IConnectionRegistration"
+ class=".connection.AddConnectionRegistration"
permission="zope.ManageServices"
- content_factory="zope.app.services.connection.ConnectionConfiguration"
+ content_factory="zope.app.services.connection.ConnectionRegistration"
arguments="name componentPath"
set_after_add="status"
fields="name componentPath permission status"
@@ -66,7 +66,7 @@
menu="zmi_views" title="Edit"
label="Edit Connection Registration"
name="index.html"
- schema="zope.app.interfaces.services.connection.IConnectionConfiguration"
+ schema="zope.app.interfaces.services.connection.IConnectionRegistration"
permission="zope.ManageServices"
fields="name componentPath permission status"
/>
=== Zope3/src/zope/app/browser/services/field.py 1.7 => 1.7.16.1 ===
--- Zope3/src/zope/app/browser/services/field.py:1.7 Fri Mar 21 15:59:24 2003
+++ Zope3/src/zope/app/browser/services/field.py Sun Jun 22 10:22:43 2003
@@ -25,6 +25,7 @@
from xml.sax.saxutils import quoteattr
from zope.app.interfaces.form import WidgetInputError
from zope.app.traversing import traverse, canonicalPath
+from zope.interface import implements
class ComponentPathWidget(BrowserWidget):
@@ -56,7 +57,7 @@
class ComponentLocationWidget(Widget, BrowserView):
- __implements__ = IBrowserWidget
+ implements(IBrowserWidget)
# Names used:
#
=== Zope3/src/zope/app/browser/services/service.py 1.25 => 1.25.12.1 ===
--- Zope3/src/zope/app/browser/services/service.py:1.25 Thu May 1 12:28:28 2003
+++ Zope3/src/zope/app/browser/services/service.py Sun Jun 22 10:22:43 2003
@@ -15,42 +15,41 @@
$Id$
"""
-
+from zope.app import zapi
from zope.app.browser.container.adding import Adding
from zope.app.browser.container.contents import Contents
from zope.app.interfaces.container import IZopeContainer
-from zope.app.interfaces.services.configuration import Registered, Active
-from zope.app.interfaces.services.configuration import Unregistered
+from zope.app.interfaces.services.registration import ActiveStatus
+from zope.app.interfaces.services.registration import RegisteredStatus
+from zope.app.interfaces.services.registration import UnregisteredStatus
from zope.app.interfaces.services.service import ILocalService
from zope.app.interfaces.services.service import IServiceManager
from zope.app.interfaces.services.utility import ILocalUtility
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.app.services.folder import SiteManagementFolder
-from zope.app.services.service import ServiceConfiguration
-from zope.app.traversing import traverse, getPath, getParent, objectName
-from zope.component import getServiceManager
-from zope.component import getView, getAdapter, queryView
-from zope.proxy.context import ContextSuper
-from zope.proxy.context import getWrapperContainer
+from zope.app.services.service import ServiceRegistration
from zope.publisher.browser import BrowserView
class ComponentAdding(Adding):
- """Adding subclass used for configurable components."""
+ """Adding subclass used for registerable components."""
menu_id = "add_component"
def add(self, content):
# Override so as to save a reference to the added object
- self.added_object = ContextSuper(ComponentAdding, self).add(content)
+ self.added_object = zapi.ContextSuper(
+ ComponentAdding, self).add(content)
return self.added_object
def nextURL(self):
- v = queryView(self.added_object, "addConfiguration.html", self.request)
+ v = zapi.queryView(
+ self.added_object, "addRegistration.html", self.request)
if v is not None:
- url = str(getView(self.added_object, 'absolute_url', self.request))
- return url + "/@@addConfiguration.html"
+ url = str(
+ zapi.getView(self.added_object, 'absolute_url', self.request))
+ return url + "/@@addRegistration.html"
- return ContextSuper(ComponentAdding, self).nextURL()
+ return zapi.ContextSuper(ComponentAdding, self).nextURL()
def action(self, type_name, id):
if type_name == "../AddService":
@@ -74,7 +73,10 @@
# Call the superclass action() method.
# As a side effect, self.added_object is set by add() above.
- ContextSuper(ComponentAdding, self).action(type_name, id)
+ zapi.ContextSuper(ComponentAdding, self).action(type_name, id)
+
+ action = zapi.ContextMethod(action)
+
class ServiceAdding(ComponentAdding):
"""Adding subclass used for adding services."""
@@ -87,7 +89,7 @@
if not ILocalService.isImplementedBy(content):
raise TypeError("%s is not a local service" % content)
- return ContextSuper(ServiceAdding, self).add(content)
+ return zapi.ContextSuper(ServiceAdding, self).add(content)
class UtilityAdding(ComponentAdding):
"""Adding subclass used for adding utilities."""
@@ -99,7 +101,7 @@
# XXX This wants to be generalized!
if not ILocalUtility.isImplementedBy(content):
raise TypeError("%s is not a local utility" % content)
- return ContextSuper(UtilityAdding, self).add(content)
+ return zapi.ContextSuper(UtilityAdding, self).add(content)
class ConnectionAdding(ComponentAdding):
"""Adding subclass used for adding database connections."""
@@ -112,17 +114,17 @@
menu_id = "add_cache"
-class AddServiceConfiguration(BrowserView):
+class AddServiceRegistration(BrowserView):
"""A view on a service implementation, used by add_svc_config.py."""
def listServiceTypes(self):
# Collect all defined services interfaces that it implements.
- sm = getServiceManager(self.context)
+ sm = zapi.getServiceManager(self.context)
lst = []
for servicename, interface in sm.getServiceDefinitions():
if interface.isImplementedBy(self.context):
- registry = sm.queryConfigurations(servicename)
+ registry = sm.queryRegistrations(servicename)
checked = True
if registry and registry.active():
checked = False
@@ -131,18 +133,19 @@
return lst
def action(self, name=[], active=[]):
- path = getPath(self.context)
- configure = getWrapperContainer(self.context).getConfigurationManager()
- container = getAdapter(configure, IZopeContainer)
+ path = zapi.name(self.context)
+ configure = zapi.getWrapperContainer(
+ self.context).getRegistrationManager()
+ container = zapi.getAdapter(configure, IZopeContainer)
for nm in name:
- sc = ServiceConfiguration(nm, path, self.context)
+ sc = ServiceRegistration(nm, path, self.context)
name = container.setObject("", sc)
sc = container[name]
if nm in active:
- sc.status = Active
+ sc.status = ActiveStatus
else:
- sc.status = Registered
+ sc.status = RegisteredStatus
self.request.response.redirect("@@SelectedManagementView.html")
@@ -173,25 +176,25 @@
def _activate(self, todo):
done = []
for name in todo:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
obj = registry.active()
if obj is None:
- # Activate the first registered configuration
- obj = registry.info()[0]['configuration']
- obj.status = Active
+ # Activate the first registered registration
+ obj = registry.info()[0]['registration']
+ obj.status = ActiveStatus
done.append(name)
if done:
return "Activated: " + ", ".join(done)
else:
- return "All of the checked services were alrady active"
+ return "All of the checked services were already active"
def _deactivate(self, todo):
done = []
for name in todo:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
obj = registry.active()
if obj is not None:
- obj.status = Registered
+ obj.status = RegisteredStatus
done.append(name)
if done:
return "Deactivated: " + ", ".join(done)
@@ -201,7 +204,7 @@
def _delete(self, todo):
errors = []
for name in todo:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
assert registry
if registry.active() is not None:
errors.append(name)
@@ -214,18 +217,18 @@
# 1) Delete the registrations
services = {}
for name in todo:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
assert registry
assert registry.active() is None # Phase error
for info in registry.info():
- conf = info['configuration']
+ conf = info['registration']
obj = conf.getComponent()
- path = getPath(obj)
+ path = zapi.getPath(obj)
services[path] = obj
- conf.status = Unregistered
- parent = getParent(conf)
- name = objectName(conf)
- container = getAdapter(parent, IZopeContainer)
+ conf.status = UnregisteredStatus
+ parent = zapi.getParent(conf)
+ name = zapi.name(conf)
+ container = zapi.getAdapter(parent, IZopeContainer)
del container[name]
# 2) Delete the service objects
@@ -237,26 +240,27 @@
# deleting a service; if you don't want that, you can
# manipulate the folder explicitly.
for path, obj in services.items():
- parent = getParent(obj)
- name = objectName(obj)
- container = getAdapter(parent, IZopeContainer)
+ parent = zapi.getParent(obj)
+ name = zapi.name(obj)
+ container = zapi.getAdapter(parent, IZopeContainer)
del container[name]
return "Deleted: %s" % ", ".join(todo)
def listConfiguredServices(self):
- names = list(self.context.listConfigurationNames())
+ names = list(self.context.listRegistrationNames())
names.sort()
items = []
for name in names:
- registry = self.context.queryConfigurations(name)
+ registry = self.context.queryRegistrations(name)
assert registry
infos = [info for info in registry.info() if info['active']]
if infos:
- configobj = infos[0]['configuration']
+ configobj = infos[0]['registration']
component = configobj.getComponent()
- url = str(getView(component, 'absolute_url', self.request))
+ url = str(
+ zapi.getView(component, 'absolute_url', self.request))
else:
url = ""
items.append({'name': name, 'url': url})
@@ -267,34 +271,50 @@
class ServiceActivation(BrowserView):
"""A view on the service manager, used by serviceactivation.pt.
- This really wants to be a view on a configuration registry
- containing service configurations, but registries don't have names,
+ This really wants to be a view on a registration registry
+ containing service registrations, but registries don't have names,
so we make it a view on the service manager; the request parameter
'type' determines which service is to be configured."""
def isDisabled(self):
- sm = getServiceManager(self.context)
- registry = sm.queryConfigurations(self.request.get('type'))
+ sm = zapi.getServiceManager(self.context)
+ registry = sm.queryRegistrations(self.request.get('type'))
return not (registry and registry.active())
def listRegistry(self):
- sm = getServiceManager(self.context)
- registry = sm.queryConfigurations(self.request.get('type'))
+ sm = zapi.getServiceManager(self.context)
+ registry = sm.queryRegistrations(self.request.get('type'))
if not registry:
return []
# XXX this code path is not being tested
result = []
- for info in registry.info():
- configobj = info['configuration']
- component = configobj.getComponent()
- path = getPath(component)
- path = path.split("/")
- info['name'] = "/".join(path[-2:])
- info['url'] = str(getView(component, 'absolute_url', self.request))
- info['config'] = str(getView(configobj, 'absolute_url',
- self.request))
+ dummy = {'id': 'None',
+ 'active': False,
+ 'registration': None,
+ 'name': '',
+ 'url': '',
+ 'config': '',
+ }
+ for info in registry.info(True):
+ configobj = info['registration']
+ if configobj is None:
+ info = dummy
+ dummy = None
+ if not result:
+ info['active'] = True
+ else:
+ component = configobj.getComponent()
+ path = zapi.getPath(component)
+ path = path.split("/")
+ info['name'] = "/".join(path[-2:])
+ info['url'] = str(
+ zapi.getView(component, 'absolute_url', self.request))
+ info['config'] = str(zapi.getView(configobj, 'absolute_url',
+ self.request))
result.append(info)
+ if dummy:
+ result.append(dummy)
return result
def update(self):
@@ -302,33 +322,22 @@
if not active:
return ""
- sm = getServiceManager(self.context)
- registry = sm.queryConfigurations(self.request.get('type'))
+ sm = zapi.getServiceManager(self.context)
+ registry = sm.queryRegistrations(self.request.get('type'))
if not registry:
return "Invalid service type specified"
old_active = registry.active()
if active == "None":
new_active = None
else:
- new_active = traverse(sm, active)
+ new_active = zapi.traverse(sm, active)
if old_active == new_active:
return "No change"
if new_active is None:
- old_active.status = Registered
+ registry.activate(None)
return "Service deactivated"
else:
- new_active.status = Active
+ new_active.status = ActiveStatus
return active + " activated"
-
-
-class SiteManagementFoldersContents(Contents):
-
- __used_for__ = IServiceManager
-
- index = ViewPageTemplateFile('sitemanagement_contents.pt')
-
- def addSiteManagementFolder(self, name):
- self.context.setObject(name, SiteManagementFolder())
- self.request.response.redirect('@@contents.html')
=== Zope3/src/zope/app/browser/services/serviceactivation.pt 1.6 => 1.6.12.1 ===
--- Zope3/src/zope/app/browser/services/serviceactivation.pt:1.6 Mon Apr 28 12:52:07 2003
+++ Zope3/src/zope/app/browser/services/serviceactivation.pt Sun Jun 22 10:22:43 2003
@@ -36,20 +36,15 @@
<td><input type="radio" name="active" value="default/configure/1"
tal:attributes="value config/id;
checked config/active" /></td>
- <td><a href="foo"
+ <td tal:condition="not:config/name">Disabled</td>
+ <td tal:condition="config/name"><a href="foo"
tal:content="config/name"
tal:attributes="href config/url">Implementation</a>
</td>
- <td><a href="foo"
+ <td tal:condition="config/name"><a href="foo"
tal:content="config/id"
tal:attributes="href config/config">Registration</a>
</td>
- </tr>
-
- <tr>
- <td><input type="radio" name="active" value="None"
- tal:attributes="checked view/isDisabled"></td>
- <td>Disable</td>
</tr>
</tbody>
=== Zope3/src/zope/app/browser/services/view.py 1.15 => 1.15.10.1 ===
--- Zope3/src/zope/app/browser/services/view.py:1.15 Thu May 1 15:35:04 2003
+++ Zope3/src/zope/app/browser/services/view.py Sun Jun 22 10:22:43 2003
@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Helper classes for local view configuration.
+"""Helper classes for local view registry.
$Id$
"""
@@ -23,21 +23,16 @@
from zope.schema import TextLine, BytesLine
from zope.component.interfaces import IPresentation
from zope.component import getAdapter, getServiceManager, getView
-from zope.proxy.context import ContextWrapper
+from zope.app.context import ContextWrapper
from zope.publisher.browser import BrowserView
from zope.app.component.interfacefield import InterfaceField
from zope.app.form.utility import setUpWidgets
from zope.app.interfaces.container import IZopeContainer
-from zope.app.interfaces.services.configuration import \
- Unregistered, Registered, Active
-from zope.app.traversing import getPath, getParent, objectName
-
-# XXX These are not used in this module, but are referenced in configure.zcml.
-# either configure.zcml should be fixed, or a comment should replace
-# this one to explain why configure.zcml is importing these two names
-# from here rather than from where they are defined.
-from zope.app.services.view import ViewConfiguration, PageConfiguration
+from zope.app.interfaces.services.registration import ActiveStatus
+from zope.app.interfaces.services.registration import RegisteredStatus
+from zope.app.interfaces.services.registration import UnregisteredStatus
+from zope.app.traversing import getPath, getParent, getName
class IViewSearch(Interface):
@@ -84,9 +79,9 @@
def _getSummaryFromRegistry(self, registry):
assert registry
- # Return the summary of the first configuration in the registry
+ # Return the summary of the first registration in the registry
for info in registry.info():
- return info['configuration'].usageSummary()
+ return info['registration'].usageSummary()
assert 0
@@ -99,7 +94,7 @@
setUpWidgets(self, IViewSearch)
def update(self):
- """Possibly deactivate or delete one or more page configurations.
+ """Possibly deactivate or delete one or more page registrations.
In that case, issue a message.
"""
@@ -124,9 +119,9 @@
registry = self._getRegistryFromKey(key)
obj = registry.active()
if obj is None:
- # Activate the first registered configuration
- obj = registry.info()[0]['configuration']
- obj.status = Active
+ # Activate the first registered registration
+ obj = registry.info()[0]['registration']
+ obj.status = ActiveStatus
done.append(self._getSummaryFromRegistry(registry))
if done:
return "Activated: " + ", ".join(done)
@@ -139,7 +134,7 @@
registry = self._getRegistryFromKey(key)
obj = registry.active()
if obj is not None:
- obj.status = Registered
+ obj.status = RegisteredStatus
done.append(self._getSummaryFromRegistry(registry))
if done:
return "Deactivated: " + ", ".join(done)
@@ -169,10 +164,10 @@
assert registry.active() is None # Phase error
done.append(self._getSummaryFromRegistry(registry))
for info in registry.info():
- conf = info['configuration']
- conf.status = Unregistered
+ conf = info['registration']
+ conf.status = UnregisteredStatus
parent = getParent(conf)
- name = objectName(conf)
+ name = getName(conf)
container = getAdapter(parent, IZopeContainer)
del container[name]
@@ -180,10 +175,10 @@
def configInfo(self):
"""Do a search, or (by default) return all view pages."""
- input_for = self.forInterface.getData()
- input_type = self.presentationType.getData()
- input_name = self.viewName.getData()
- input_layer = self.layer.getData()
+ input_for = self.forInterface_widget.getData()
+ input_type = self.presentationType_widget.getData()
+ input_name = self.viewName_widget.getData()
+ input_layer = self.layer_widget.getData()
result = []
for info in self.context.getRegisteredMatching(
@@ -205,7 +200,7 @@
presentationType.__module__ +"."+ presentationType.__name__)
registry = ContextWrapper(registry, self.context)
- view = getView(registry, "ChangeConfigurations", self.request)
+ view = getView(registry, "ChangeRegistrations", self.request)
# XXX Why are we setting this unique prefix?
prefix = md5.new('%s %s' %
(forInterface, presentationType)).hexdigest()
@@ -241,12 +236,12 @@
return result
-class PageConfigurationView(BrowserView):
+class PageRegistrationView(BrowserView):
"""Helper class for the page edit form."""
def update(self):
- super(PageConfigurationView, self).update()
+ super(PageRegistrationView, self).update()
if "UPDATE_SUBMIT" in self.request:
self.context.validate()
@@ -255,7 +250,7 @@
def update(self):
key = self.request['key']
registry = self._getRegistryFromKey(key)
- form = getView(registry, "ChangeConfigurations", self.request)
+ form = getView(registry, "ChangeRegistrations", self.request)
form.update()
return form
=== Zope3/src/zope/app/browser/services/view.zcml 1.2 => 1.2.12.1 ===
--- Zope3/src/zope/app/browser/services/view.zcml:1.2 Thu May 1 11:51:24 2003
+++ Zope3/src/zope/app/browser/services/view.zcml Sun Jun 22 10:22:43 2003
@@ -29,18 +29,18 @@
/>
<editform
- schema="zope.app.interfaces.services.view.IPageConfiguration"
+ schema="zope.app.interfaces.services.view.IPageRegistration"
name="index.html"
- class=".view.PageConfigurationView"
+ class=".view.PageRegistrationView"
menu="zmi_views"
label="Change page"
permission="zope.ManageServices"
/>
<addform
- schema="zope.app.interfaces.services.view.IPageConfiguration"
- name="PageConfiguration"
- content_factory=".view.PageConfiguration"
+ schema="zope.app.interfaces.services.view.IPageRegistration"
+ name="PageRegistration"
+ content_factory="zope.app.services.view.PageRegistration"
keyword_arguments="forInterface class_ viewName permission layer"
set_before_add="template"
label="Register a view page"
@@ -53,11 +53,11 @@
So I'm commenting it out for now.
<defaultView
- for="zope.app.interfaces.services.view.IViewConfiguration"
+ for="zope.app.interfaces.services.view.IViewRegistration"
name="edit.html" />
<editform
- schema="zope.app.interfaces.services.view.IViewConfiguration"
+ schema="zope.app.interfaces.services.view.IViewRegistration"
name="edit.html"
menu="zmi_views"
label="Change view"
@@ -65,9 +65,9 @@
/>
<addform
- schema="zope.app.interfaces.services.view.IViewConfiguration"
- name="ViewConfiguration"
- content_factory=".view.ViewConfiguration"
+ schema="zope.app.interfaces.services.view.IViewRegistration"
+ name="ViewRegistration"
+ content_factory=".view.ViewRegistration"
keyword_arguments="forInterface presentationType class_
viewName permission"
set_before_add="layer"
@@ -79,8 +79,8 @@
<menuItem
for="zope.app.interfaces.container.IAdding"
- menu="add_configuration"
- action="ViewConfiguration"
+ menu="add_registration"
+ action="ViewRegistration"
title="View"
/>
=== Zope3/src/zope/app/browser/services/views.pt 1.3 => 1.3.12.1 ===
--- Zope3/src/zope/app/browser/services/views.pt:1.3 Thu May 1 11:51:24 2003
+++ Zope3/src/zope/app/browser/services/views.pt Sun Jun 22 10:22:43 2003
@@ -52,10 +52,14 @@
<h3>Search filter:</h3>
<form action="." method="GET">
- <div class="row" tal:content="structure view/forInterface/row" />
+ <div class="row"
+ tal:content="structure view/forInterface_widget/row"
+ />
<!-- presentationType search is not useful yet since we can
so far only register "pages", which are a browser-only concept.
- <div class="row" tal:content="structure view/presentationType/row" />
+ <div class="row"
+ tal:content="structure view/presentationType_widget/row"
+ />
-->
<div class="row">
<div class="controls">
=== Removed File Zope3/src/zope/app/browser/services/pagefolder_contents.pt ===
=== Removed File Zope3/src/zope/app/browser/services/sitemanagement_contents.pt ===