-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an explanation for calling removeAllProxies
- Loading branch information
Jim Fulton
committed
Aug 13, 2004
1 parent
dfdd4fa
commit 0f0c9e7
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2002 Zope Corporation and Contributors. | ||
# All Rights Reserved. | ||
# | ||
# This software is subject to the provisions of the Zope Public License, | ||
# Version 2.1 (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 | ||
$Id$ | ||
""" | ||
|
||
from zope.app import zapi | ||
from zope.app.dependable.interfaces import IDependable, DependencyError | ||
from zope.proxy import removeAllProxies | ||
|
||
def CheckDependency(event): | ||
|
||
# We have to remove the proxies here to be able to get at | ||
# annotations. Perhaps this should be a trusted subscriber, but we | ||
# don't have those yet. | ||
|
||
object = removeAllProxies(event.object) | ||
dependency = IDependable(object, None) | ||
if dependency is not None: | ||
dependents = dependency.dependents() | ||
if dependents: | ||
objectpath = zapi.getPath(event.object) | ||
raise DependencyError("Removal of object (%s)" | ||
" which has dependents (%s)" | ||
% (objectpath, | ||
", ".join(dependents))) |