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

# Source Code for Module Products.ZenRelations.subscribers

     1  ###########################################################################
     2  #
     3  # This program is part of Zenoss Core, an open source monitoring platform.
     4  # Copyright (C) 2009, 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.ZenRelations.ToOneRelationship import ToOneRelationship
    14
    15
    16 -def cleanUpRelationships(ob, event):
    17      """
    18      Unlinks non-container relationships when their targets are being deleted.
    19      """
    20      if getattr(event.object, "_operation", -1) < 1:
    21          # Don't bother in the case where the other side is a container.
    22          if not (isinstance(ob, ToOneRelationship) and
    23              ob.remoteTypeName() == 'ToManyCont'):
    24              ob._remoteRemove()
    25
    26
    27 -def resetUnderscoreOperation(ob, event):
    28      """
    29      Make sure that the _operation attribute on a RelationshipManager is reset
    30      after paste/move/rename.
    31      """
    32      if ob._operation > -1: ob._operation = -1
    33