Belle II Software  release-08-01-10
DefaultValueFormatter Class Reference
Inheritance diagram for DefaultValueFormatter:
Collaboration diagram for DefaultValueFormatter:

Public Member Functions

def format_field (self, value, spec)
 
def get_field (self, field_name, args, kwargs)
 

Detailed Description

Custom formatter class which allows to substitute a missing value with a
default value

Definition at line 151 of file format.py.

Member Function Documentation

◆ format_field()

def format_field (   self,
  value,
  spec 
)
Format a single field:

* if the field is None and we have a ``:=`` specification we replace
  the field with the default value and change the spec to 's'
* if the value is None we replace it with an empty string

then we just run the normal formatter ...

Definition at line 155 of file format.py.

◆ get_field()

def get_field (   self,
  field_name,
  args,
  kwargs 
)
Try to get the field as usual but in case we cannot find it because it
either doesn't exist or it doesn't have the correct attribute/item we
just return None

Definition at line 174 of file format.py.


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