Next / Previous / Contents / Shipman's homepage

27.2. SingleField.flatten(): Flatten single-character field

All fields derived from this class represent the .value in the instance as a one-character string. To flatten such an instance, we merely return its .value attribute. We also handle the case where the argument is None by returning a single space.

baseclasses.py
# - - -   S i n g l e F i e l d . f l a t t e n   - - -

    @staticmethod
    def flatten(object):
        '''Flatten a single-column field.
        '''
        if  object is None:
            return ' '
        else:
            return object.value