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

# Source Code for Package Products.ZenUtils

     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  from Products.CMFCore.DirectoryView import registerDirectory
    12  registerDirectory('js', globals())
    13
    14  # import any monkey patches that may be necessary
    15  from patches import pasmonkey
    16  from patches import dirviewmonkey
    17  from Products.ZenUtils.Utils import unused
    18  unused(pasmonkey, dirviewmonkey)
    19
    20  from Products.ZenUtils.MultiPathIndex import MultiPathIndex , \
    21                                               manage_addMultiPathIndex, \
    22                                               manage_addMultiPathIndexForm
    23
    24 -def initialize(context):
    25      context.registerClass(
    26          MultiPathIndex,
    27          permission='Add Pluggable Index',
    28          constructors=(manage_addMultiPathIndexForm, manage_addMultiPathIndex),
    29          #icon="www/index.gif",
    30          visibility=None)
    31
    32 -def safeTuple(arg):
    33      """
    34      >>> safeTuple(["foo", "blam"])
    35      ('foo', 'blam')
    36      >>> safeTuple([])
    37      ()
    38      >>> safeTuple(None)
    39      ()
    40      >>> safeTuple("foo")
    41      ('foo',)
    42      """
    43      if arg is not None:
    44          return tuple(arg) if hasattr(arg, '__iter__') else (arg,)
    45      else:
    46          return ()
    47