| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | List of all members
GaudiKernel.PropertyProxy.DataObjectHandleBasePropertyProxy Class Reference
Inheritance diagram for GaudiKernel.PropertyProxy.DataObjectHandleBasePropertyProxy:
[legend]
Collaboration diagram for GaudiKernel.PropertyProxy.DataObjectHandleBasePropertyProxy:
[legend]

## Public Member Functions
def | __init__ (self, descr, docString, default)
def | __get__ (self, obj, type=None)
def | __set__ (self, obj, value)
def | convertValueToBeSet (self, obj, value)
Public Member Functions inherited from GaudiKernel.PropertyProxy.PropertyProxy
def | setDefault (self, value)
def | getDefault (self)
def | fullPropertyName (self, obj)
def | __delete__ (self, obj)

## Additional Inherited Members
Public Attributes inherited from GaudiKernel.PropertyProxy.PropertyProxy
| history
| descr
| deprecated
Static Public Attributes inherited from GaudiKernel.PropertyProxy.PropertyProxy
| proptype = type(self.default)
| allowcompat = True
bool | allowcompat = True
| value = _isCompatible(proptype, value)
def | oldvec = self.descr.__get__(obj, type)
| tpo = type(oldvec[0])
Properties inherited from GaudiKernel.PropertyProxy.PropertyProxy
| default = property(getDefault, setDefault)

## Detailed Description

Definition at line 378 of file PropertyProxy.py.

## Constructor & Destructor Documentation

## ◆ __init__()

def GaudiKernel.PropertyProxy.DataObjectHandleBasePropertyProxy.__init__ | ( |  | self,
|  |  | descr,
|  |  | docString,
|  |  | default
| ) |  |

Reimplemented from GaudiKernel.PropertyProxy.PropertyProxy.

Definition at line 379 of file PropertyProxy.py.

379 def __init__(self, descr, docString, default):
380 PropertyProxy.__init__(self, descr, docString, default)
381

## Member Function Documentation

## ◆ __get__()

def GaudiKernel.PropertyProxy.DataObjectHandleBasePropertyProxy.__get__ | ( |  | self,
|  |  | obj,
|  |  | type = `None`
| ) |  |

Reimplemented from GaudiKernel.PropertyProxy.PropertyProxy.

Definition at line 382 of file PropertyProxy.py.

382 def __get__(self, obj, type=None):
383 try:
384 return self.descr.__get__(obj, type)
385 except AttributeError:
386 # Get default
387 try:
388 default = obj.__class__.getDefaultProperty(self.descr.__name__)
389 default = self.convertValueToBeSet(obj, default)
390 if default:
391 self.__set__(obj, default)
392 except AttributeError as e:
393 # change type of exception to avoid false error message
394 raise RuntimeError(*e.args)
395
396 return self.descr.__get__(obj, type)
397

## ◆ __set__()

def GaudiKernel.PropertyProxy.DataObjectHandleBasePropertyProxy.__set__ | ( |  | self,
|  |  | obj,
|  |  | value
| ) |  |

Reimplemented from GaudiKernel.PropertyProxy.PropertyProxy.

Definition at line 398 of file PropertyProxy.py.

398 def __set__(self, obj, value):
399 if not obj._isInSetDefaults() or not obj in self.history:
400 value = self.convertValueToBeSet(obj, value)
401 # assign the value
402 self.descr.__set__(obj, value)
403 log.debug("Setting %s = %r", self.fullPropertyName(obj), value)
404 self.history.setdefault(obj, []).append(value)
405

## ◆ convertValueToBeSet()

def GaudiKernel.PropertyProxy.DataObjectHandleBasePropertyProxy.convertValueToBeSet | ( |  | self,
|  |  | obj,
|  |  | value
| ) |  |

Definition at line 406 of file PropertyProxy.py.

406 def convertValueToBeSet(self, obj, value):
407 if value is None:
408 value = ''
409
410 mode = obj.__class__.getDefaultProperty(self.descr.__name__).mode()
411 if type(value) == str:
412 return DataObjectHandleBase(value, mode)
413 elif isinstance(value, DataObjectHandleBase):
414 return DataObjectHandleBase(value.__str__(), mode)
415 else:
416 raise ValueError("received an instance of %s, but %s expected" %
417 (type(value), 'str or DataObjectHandleBase'))
418
419
gaudirun.type
type
Definition: gaudirun.py:142
DataObjectHandleBase
DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h.
Definition: DataObjectHandleBase.h:26

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

- GaudiKernel/python/GaudiKernel/PropertyProxy.py