:date: 2018-03-19
======================
Monday, March 19, 2018
======================
I fixed :ticket:`2348` (Output of doctest.show_fields() differs
(Python 2*3)). This was not an easy one. It seems that the sort
order of the 3 virtual fields defined on
:class:`lino.core.model.Model` (:attr:`workflow_buttons` etc) was not
correct under Python 2. As a workaround I added an option `all=False`
to :func:`lino.api.show_fields` which hides fields that have no
`help_text`. Of course this caused some existing test snippets to
fail. And *en passant* I updated some help texts.
A failure in :ref:`book.specs.dumps` was another example why it is
difficult to delegate this job because it requires quite some
experience with the Lino internals. When Hamza asked me some weeks
ago how to handle this failure, I told him to maybe create two
different directories for the expected files, one for Python 2 and
another for Python 3. When I now looked at it, I saw that there was an
easier and better way: BabelFields still used a ``u`` prefix when
writing their values to the stream. I removed that ``u`` and voilà!
There were several doctests which failed because the attributes of an
```` tag in Python 3 are not in the same order as in Python 2. You
never know which of the following lines would come::
⁜
⁜
⁜
During a production upgrade for :ref:`cpaschatelet` I made an optimization
about the behaviour of choicelists in a python dump. And yes, it
seems that specifying the default value for a choicelist field no
longer requires that as_callable method, simply specify the choice's
`name` as a string. That's because :meth:`ChoiceListField.to_python`
now resolves string values also as names.