Gaudi Framework, version v23r4

Home   Generated: Mon Sep 17 2012

__init__.py

Go to the documentation of this file.
00001 import os, sys
00002 
00003 __configurables_module_fullname__ = __name__ + '.Configurables'
00004 __ignore_missing_configurables__ = False
00005 
00006 ## Small class that allows to access all the configurables as attributes of the
00007 #  instance.
00008 #  Used as module to allow code like
00009 #  @code
00010 #  from Gaudi.Configuration import Configurables
00011 #  Configurables.MyConf()
00012 #  @endcode
00013 class _ConfigurablesModule(object):
00014     ## Initializes the instance
00015     def __init__(self):
00016         ## If set to true, does not raise an AttributeError if the configurable is not found.
00017         self.ignoreMissingConfigurables = False
00018 
00019     def __getattr__(self, name):
00020         # trigger the load of the configurables database
00021         from Gaudi.Configuration import confDbGetConfigurable, cfgDb
00022         from Gaudi.CommonGaudiConfigurables import aliases
00023         # return value
00024         retval = None
00025         # handle the special cases (needed for modules): __all__, __path__
00026         if name == "__all__":
00027             retval = cfgDb.keys()
00028         elif name == "__path__":
00029             retval == None
00030         elif name in cfgDb.keys(): # ignore private names
00031             retval = confDbGetConfigurable(name)
00032         elif name in aliases: # special case of aliases
00033             retval = aliases[name]
00034         elif self.ignoreMissingConfigurables:
00035             import logging
00036             logging.getLogger(__configurables_module_fullname__).warning('Configurable class %s not in database', name)
00037         else:
00038             # We raise an AttributeError exception if the configurable could not be found
00039             # to respect the Python semantic.
00040             raise AttributeError("module '%s' does not have attribute '%s'" % (__configurables_module_fullname__, name))
00041         return retval
00042 
00043 # install the facade module instance as a module
00044 Configurables = _ConfigurablesModule()
00045 sys.modules[__configurables_module_fullname__] = Configurables
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Mon Sep 17 2012 13:49:25 for Gaudi Framework, version v23r4 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004