[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container - DependencyChecker.py:1.4 IZopeContainer.py:1.4
Marius Gedminas
mgedmin@codeworks.lt
Thu, 12 Dec 2002 06:33:00 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container
In directory cvs.zope.org:/tmp/cvs-serv21266/lib/python/Zope/App/OFS/Container
Modified Files:
DependencyChecker.py IZopeContainer.py
Log Message:
Merge named-component-configuration-branch
=== Zope3/lib/python/Zope/App/OFS/Container/DependencyChecker.py 1.3 => 1.4 ===
--- Zope3/lib/python/Zope/App/OFS/Container/DependencyChecker.py:1.3 Sat Nov 30 13:32:14 2002
+++ Zope3/lib/python/Zope/App/OFS/Container/DependencyChecker.py Thu Dec 12 06:32:29 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 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.
-#
+#
##############################################################################
"""Objects that take care of annotating dublin core meta data times
@@ -20,12 +20,13 @@
from Zope.App.DependencyFramework.Exceptions import DependencyError
from Zope.Event.ISubscriber import ISubscriber
from Zope.Proxy.ProxyIntrospection import removeAllProxies
+from Zope.App.Traversing import getPhysicalPathString, locationAsUnicode
class DependencyChecker:
"""Checking dependency while deleting object
"""
__implements__ = ISubscriber
-
+
def __init__(self):
pass
@@ -33,10 +34,13 @@
object = removeAllProxies(event.object)
dependency = queryAdapter(object, IDependable)
if dependency is not None:
- if dependency.dependents():
- raise DependencyError(" Removal of object dependable")
-
-CheckDependency = DependencyChecker()
-
-
-
+ dependents = dependency.dependents()
+ if dependents:
+ objectpath = getPhysicalPathString(event.object)
+ dependents = map(locationAsUnicode, dependents)
+ raise DependencyError("Removal of object (%s)"
+ " which has dependents (%s)"
+ % (objectpath,
+ ", ".join(dependents)))
+
+CheckDependency = DependencyChecker()
=== Zope3/lib/python/Zope/App/OFS/Container/IZopeContainer.py 1.3 => 1.4 ===
--- Zope3/lib/python/Zope/App/OFS/Container/IZopeContainer.py:1.3 Tue Nov 19 09:45:54 2002
+++ Zope3/lib/python/Zope/App/OFS/Container/IZopeContainer.py Thu Dec 12 06:32:29 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 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.
-#
+#
##############################################################################
"""
$Id$
@@ -26,7 +26,7 @@
The returned value will be in the context of the container.
"""
-
+
class IZopeSimpleReadContainer(IZopeItemContainer,
@@ -38,11 +38,11 @@
"""Get a value for a key
The default is returned if there is no value for the key.
-
- The value for the key will be in the context of the container.
+
+ The value for the key will be in the context of the container.
"""
-
-
+
+
class IZopeReadContainer(IZopeSimpleReadContainer, IContainer.IReadContainer):
"""Readable containers that can be enumerated.
@@ -59,7 +59,7 @@
of the container
"""
-
+
class IZopeWriteContainer(IContainer.IWriteContainer):
"""An interface for the write aspects of a container."""
@@ -80,7 +80,7 @@
object in the context of the container
An IObjectModifiedEvent will be published after the IObjectAddedEvent
- is published. The event object will be the container.
+ is published. The event object will be the container.
"""
def __delitem__(key):
@@ -88,7 +88,7 @@
Raises a KeyError if the object is not found.
- If the object has an adpter to IDeleteNotifyObject then the
+ If the object has an adpter to IDeleteNotifiable then the
manageBeforeDeleteObject method on the adpter will be called before
the object is removed.
@@ -100,6 +100,6 @@
is published. The event object will be the container.
"""
-class IZopeContainer(IZopeReadContainer, IContainer.IContainer):
+class IZopeContainer(IZopeReadContainer, IZopeWriteContainer, IContainer.IContainer):
"""Readable and writable content container."""