Gaudi Framework, version v21r4

Home   Generated: 7 Sep 2009

__init__.py

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

Generated at Mon Sep 7 18:05:34 2009 for Gaudi Framework, version v21r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004