Skip to content

Commit

Permalink
Added an explanation for calling removeAllProxies
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Fulton committed Aug 13, 2004
1 parent dfdd4fa commit 0f0c9e7
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions dependency.py
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)))

0 comments on commit 0f0c9e7

Please sign in to comment.