Package Products :: Package ZenModel :: Module subscribers |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenModel.subscribers

     1  ###########################################################################
     2  #
     3  # This program is part of Zenoss Core, an open source monitoring platform.
     4  # Copyright (C) 2007, Zenoss Inc.
     5  #
     6  # This program is free software; you can redistribute it and/or modify it
     7  # under the terms of the GNU General Public License version 2 as published by
     8  # the Free Software Foundation.
     9  #
    10  # For complete information please visit: http://www.zenoss.com/oss/
    11  #
    12  ###########################################################################
    13  from Products.ZenModel.IpInterface import IpInterface, beforeDeleteIpInterface
    14  from OFS.interfaces import IObjectWillBeAddedEvent
    15  from zope.app.container.interfaces import IObjectRemovedEvent
    16
    17 -def unindexBeforeDelete(ob, event):
    18      """
    19      Multisubscriber for IIndexed + IObjectWillBeMovedEvent
    20      """
    21      if not IObjectWillBeAddedEvent.providedBy(event):
    22          if isinstance(ob, IpInterface):
    23              beforeDeleteIpInterface(ob, event)
    24          else:
    25              ob.unindex_object()
    26
    27 -def indexAfterAddOrMove(ob, event):
    28      """
    29      Multisubscriber for IIndexed + IObjectMovedEvent.
    30      """
    31      if not IObjectRemovedEvent.providedBy(event):
    32          ob.index_object()
    33