All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Gaudi._ConfigurablesModule Class Reference

Small class that allows to access all the configurables as attributes of the instance. More...

Inheritance diagram for Gaudi._ConfigurablesModule:
Collaboration diagram for Gaudi._ConfigurablesModule:

Public Member Functions

def __init__
 Initializes the instance.
 
def __getattr__
 
def __init__
 Initializes the instance.
 
def __getattr__
 

Public Attributes

 ignoreMissingConfigurables
 If set to true, does not raise an AttributeError if the configurable is not found.
 

Private Attributes

 __name__
 

Detailed Description

Small class that allows to access all the configurables as attributes of the instance.

Used as module to allow code like

1 from Gaudi.Configuration import Configurables
2 Configurables.MyConf()

Definition at line 13 of file __init__.py.

Constructor & Destructor Documentation

def Gaudi._ConfigurablesModule.__init__ (   self)

Initializes the instance.

Definition at line 15 of file __init__.py.

15 
16  def __init__(self):
17  ## If set to true, does not raise an AttributeError if the configurable is not found.
19  self.__name__ = __configurables_module_fullname__
def Gaudi._ConfigurablesModule.__init__ (   self)

Initializes the instance.

Definition at line 15 of file __init__.py.

15 
16  def __init__(self):
17  ## If set to true, does not raise an AttributeError if the configurable is not found.
19  self.__name__ = __configurables_module_fullname__

Member Function Documentation

def Gaudi._ConfigurablesModule.__getattr__ (   self,
  name 
)

Definition at line 20 of file __init__.py.

20 
21  def __getattr__(self, name):
22  # trigger the load of the configurables database
23  from Gaudi.Configuration import confDbGetConfigurable, cfgDb
24  from Gaudi.CommonGaudiConfigurables import aliases
25  # return value
26  retval = None
27  # handle the special cases (needed for modules): __all__, __path__
28  if name == "__all__":
29  retval = cfgDb.keys()
30  elif name == "__path__":
31  raise AttributeError("'module' object has no attribute '__path__'")
32  elif name in cfgDb.keys(): # ignore private names
33  retval = confDbGetConfigurable(name)
34  elif name in aliases: # special case of aliases
35  retval = aliases[name]
37  import logging
38  logging.getLogger(__configurables_module_fullname__).warning('Configurable class %s not in database', name)
39  else:
40  # We raise an AttributeError exception if the configurable could not be found
41  # to respect the Python semantic.
42  raise AttributeError("module '%s' does not have attribute '%s'" % (__configurables_module_fullname__, name))
43  return retval
44 
# install the facade module instance as a module
def Gaudi._ConfigurablesModule.__getattr__ (   self,
  name 
)

Definition at line 20 of file __init__.py.

20 
21  def __getattr__(self, name):
22  # trigger the load of the configurables database
23  from Gaudi.Configuration import confDbGetConfigurable, cfgDb
24  from Gaudi.CommonGaudiConfigurables import aliases
25  # return value
26  retval = None
27  # handle the special cases (needed for modules): __all__, __path__
28  if name == "__all__":
29  retval = cfgDb.keys()
30  elif name == "__path__":
31  raise AttributeError("'module' object has no attribute '__path__'")
32  elif name in cfgDb.keys(): # ignore private names
33  retval = confDbGetConfigurable(name)
34  elif name in aliases: # special case of aliases
35  retval = aliases[name]
37  import logging
38  logging.getLogger(__configurables_module_fullname__).warning('Configurable class %s not in database', name)
39  else:
40  # We raise an AttributeError exception if the configurable could not be found
41  # to respect the Python semantic.
42  raise AttributeError("module '%s' does not have attribute '%s'" % (__configurables_module_fullname__, name))
43  return retval
44 
# install the facade module instance as a module

Member Data Documentation

Gaudi._ConfigurablesModule.__name__
private

Definition at line 18 of file __init__.py.

Gaudi._ConfigurablesModule.ignoreMissingConfigurables

If set to true, does not raise an AttributeError if the configurable is not found.

Definition at line 17 of file __init__.py.


The documentation for this class was generated from the following files: