def view_fields(self, *attributes, **options):
        """ Returns an :class:`ordered dictionary <collections.OrderedDict>` which
        contains the selected field *attributes* of the `Pointer` field itself
        extended with a ``['data']`` key which contains the selected field *attribute*
        or the dictionaries of the selected field *attributes* for each :class:`Field`
        *nested* in the :attr:`data` object referenced by the `Pointer` field.

        The *attributes* of each :class:`Field` for containers *nested* in the
        :attr:`data` object referenced by the `Pointer` field are viewed as well
        (chained method call).

        :param str attributes: selected :class:`Field` attributes.
            Fallback is the field :attr:`~Field.value`.
        :keyword tuple fieldnames: sequence of dictionary keys for the selected
            field *attributes*. Defaults to ``(*attributes)``.
        :keyword bool nested: if ``True`` all :class:`Pointer` fields in the
            :attr:`data` object referenced by the `Pointer` field views their
            referenced :attr:`~Pointer.data` object field attributes as well
            (chained method call).
        """
        items = OrderedDict()

        # Pointer field
        if attributes:
            field_getter = attrgetter(*attributes)
        else:
            field_getter = attrgetter('value')

        if len(attributes) > 1:
            for key, value in zip(attributes, field_getter(self)):
                items[key] = value
        else:
            items['value'] = field_getter(self)

        # Data object
        if is_container(self._data):
            # Container
            items['data'] = self._data.view_fields(*attributes, **options)
        elif is_pointer(self._data) and get_nested(options):
            # Pointer
            items['data'] = self._data.view_fields(*attributes, **options)
        elif is_field(self._data):
            # Field
            if attributes:
                field_getter = attrgetter(*attributes)
            else:
                field_getter = attrgetter('value')
            if len(attributes) > 1:
                fieldnames = options.get('fieldnames', attributes)
                items['data'] = dict(zip(fieldnames, field_getter(self._data)))
            else:
                items['data'] = field_getter(self._data)
        else:
            # None
            items['data'] = self._data
        return items
def view_fields ( self , * attributes , ** options ) : items = OrderedDict ( ) if attributes : field_getter = attrgetter ( * attributes ) else : field_getter = attrgetter ( 'value' ) if len ( attributes ) > 1 : for key , value in zip ( attributes , field_getter ( self ) ) : items [ key ] = value else : items [ 'value' ] = field_getter ( self ) if is_container ( self . _data ) : items [ 'data' ] = self . _data . view_fields ( * attributes , ** options ) elif is_pointer ( self . _data ) and get_nested ( options ) : items [ 'data' ] = self . _data . view_fields ( * attributes , ** options ) elif is_field ( self . _data ) : if attributes : field_getter = attrgetter ( * attributes ) else : field_getter = attrgetter ( 'value' ) if len ( attributes ) > 1 : fieldnames = options . get ( 'fieldnames' , attributes ) items [ 'data' ] = dict ( zip ( fieldnames , field_getter ( self . _data ) ) ) else : items [ 'data' ] = field_getter ( self . _data ) else : items [ 'data' ] = self . _data return items
Returns an :class:`ordered dictionary <collections.OrderedDict>` which
        contains the selected field *attributes* of the `Pointer` field itself
        extended with a ``['data']`` key which contains the selected field *attribute*
        or the dictionaries of the selected field *attributes* for each :class:`Field`
        *nested* in the :attr:`data` object referenced by the `Pointer` field.

        The *attributes* of each :class:`Field` for containers *nested* in the
        :attr:`data` object referenced by the `Pointer` field are viewed as well
        (chained method call).

        :param str attributes: selected :class:`Field` attributes.
            Fallback is the field :attr:`~Field.value`.
        :keyword tuple fieldnames: sequence of dictionary keys for the selected
            field *attributes*. Defaults to ``(*attributes)``.
        :keyword bool nested: if ``True`` all :class:`Pointer` fields in the
            :attr:`data` object referenced by the `Pointer` field views their
            referenced :attr:`~Pointer.data` object field attributes as well
            (chained method call).