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

# Source Code for Package Products.ZenRelations

     1  ##############################################################################
     2  #
     3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved.
     4  #
     5  # This content is made available according to terms specified in
     6  # License.zenoss under the directory where your Zenoss product is installed.
     7  #
     8  ##############################################################################
     9
    10
    11  __doc__="""__init__
    12
    13  Initialize the RelationshipManager Product
    14
    15  $Id: __init__.py,v 1.9 2002/12/06 14:25:57 edahl Exp $"""
    16
    17  __version__ = "$Revision: 1.9 $"[11:-2]
    18
    19  import logging
    20  from RelationshipManager import RelationshipManager, addRelationshipManager, \
    21                                  manage_addRelationshipManager
    22  from ToOneRelationship import ToOneRelationship, addToOneRelationship, \
    23                                  manage_addToOneRelationship
    24  from ToManyRelationship import ToManyRelationship, addToManyRelationship, \
    25                                  manage_addToManyRelationship
    26  from ToManyContRelationship import ToManyContRelationship, \
    27                                  addToManyContRelationship, \
    28                                  manage_addToManyContRelationship
    29  from Products.ZenRelations.ZenPropertyManager import setDescriptors
    30
    31  log = logging.getLogger("zen.ZenRelations")
    32
    33 -class ZODBConnectionError(Exception):
    34      pass
    35
    36 -def initialize(registrar):
    37      registrar.registerClass(
    38          RelationshipManager,
    39          constructors = (addRelationshipManager, manage_addRelationshipManager))
    40      registrar.registerBaseClass(RelationshipManager)
    41      registrar.registerClass(
    42          ToOneRelationship,
    43          constructors = (addToOneRelationship, manage_addToOneRelationship),
    44          icon = 'www/ToOneRelationship_icon.gif')
    45      registrar.registerClass(
    46          ToManyRelationship,
    47          constructors = (addToManyRelationship, manage_addToManyRelationship),
    48          icon = 'www/ToManyRelationship_icon.gif')
    49      registrar.registerClass(
    50          ToManyContRelationship,
    51          constructors = (addToManyContRelationship,
    52                          manage_addToManyContRelationship),
    53          icon = 'www/ToManyContRelationship_icon.gif')
    54
    55 -def registerDescriptors(event):
    56      """
    57      Handler for IZopeApplicationOpenedEvent which registers property descriptors.
    58      """
    59      zport = getattr(event.app, 'zport', None)
    60      # zport may not exist if we are using zenbuild to initialize the database
    61      if zport:
    62          try:
    63              setDescriptors(zport.dmd)
    64          except Exception, e:
    65              args = (e.__class__.__name__, e)
    66              log.info("Unable to set property descriptors: %s: %s", *args)
    67