20131022 (Tuesday, 22 October 2013)

Miscellaneous bugfixes

Fixed some non-severe bugs which had caused unnecessary internal server errors:

- AttributeError at /api/contacts/Partners/null : 'NoneType' object has no attribute 'name'

- AttributeError at /api/outbox/MyOutbox : 'AnonymousUser' object has no attribute 'get_typed_instance'
  http://127.0.0.1:8000/api/outbox/MyOutbox?start=0&limit=23&fmt=json

- TypeError: Problem installing fixture '/home/luc/hgwork/faggio/lino_faggio/fixtures/eiche.py': can't compare datetime.date to NoneType

Django’s LANGUAGES setting

Instantiating a Site now (again) reduces Django’s LANGUAGES setting to contain only the languages found in settings.SITE.languages.

Background : Lino applications don’t use Django’s LANGUAGES setting because they have settings.SITE.languages. For some time I thought that consequently we don’t touch it. OTOH it is really useless to have it contain all kind of languages, and Django includes it as part of the email report generated for each internal server error where it is at least irritating.

Thou shalt not use the name of a library module for your own modules

I discovered another example for the above commandment: The doctests in the north.site module were not being tested… because site is a Python library module!

This comes because we use atelier.doctest_utf8 (required because we need non-ASCII strings), which contains code originally copied from Python 2.7 doctest.py which says:

# It is a module -- insert its dir into sys.path and try to
# import it. If it is part of a package, that possibly
# won't work because of package imports.

Workaround:

  • Renamed north.site to north.north_site

  • adapted north/tests/__init.py

  • Renamed lino.site to lino.lino_site

Checkin

Most tests are now passing (Lino Welfare has some trivial failures which I leave open until the new conflicting events handling is stable). Checkin and updated the Public demo sites.

Shortcut for inserting in combobox

The “Lookup” button of a combobox whose value is empty used to display a message ‘Cannot show detail for empty foreign key.’ Now it calls the insert handler.

In linoweb.js I already increased the minListWidth of Lino.ComboBox and implemented a initList of Lino.RemoteComboFieldElement which shows that we can add a button to the Pagination toolbar of the list.

Another way might be to add buttons directly in the cell renderer.

Also (optionally) remove clickability of cell renderers (“Lino.fk_renderer”), and in that case a TwinCombo would make sense also for a grid editor cell (lino.ui.elems.ForeignKeyElement). But it doesn’t yet work from a grid because combo.getValue() doesn’t return the primary key…

Width of date fields

Aha! It seems that I fixed a nasty layout bug: Date fields were often displayed so that their trigger button (the button used to show the date picker) was hidden by the next field.

I removed the boxMinWidth: Lino.chars2width(11) which obviously doesn’t work as expected and anyway (officially) exists only since ExtJS 3.4.0 and changed the preferred_width of DateFieldElement from 8 to 13.

AssignCoach sometimes fails

In Lino Welfare newcomers.AssignCoach sometimes fails with a message ‘NoneType’ object has no attribute ‘attname’. Tried to reproduce it. Without success. Added a call to coaching.full_clean() before saving it.