20120107

Test suites pass again

The unit test suite revealed another bug:

INFO 20120103 /api/dsbe/CourseProviders?fmt=json&limit=30&start=0
INFO 20120107 Store <class 'lino.apps.dsbe.models.CourseProvider'>
row2list(Company #197 (u'Arbeitsamt der D.G.'))
AttributeError: 'Company' object has no attribute 'company_ptr'

This was because Tables are no longer singletons. The CourseProviders table request received Company objects instead of CourseProvider. lino.core.table.Table.base_queryset was not None if the base table had had a request before. The same effect probably happened for lino.ui.base.Handled._handles, (at least theoretically… it didn’t become visible) anyway now we also there make sure to “disconnect” from the the base class’s _handles instance by creating a new dict() object for each handle. Performance is not an issue there since this happens only once per UI and Table.

Now the test suites for both igen and dsbe pass again.

Remote fields

Added the possibility to specify fields on a related model through a ForeignKey using Django’s __ separator. First use case is lino.modlib.jobs.models.ContractsByUser:

class ContractsByUser(Contracts):

    column_names = 'person person__national_id person__gender applies_from applies_until job id user type *'

TODO: the default value for preferred_width isn’t correct.

New ideas

  • Opened docs/tickets/53, but this is going to wait until there’s concrete need.
  • I realized that before continuing with docs/tickets/52 (the last steps will probably be rather stupid routine work), I prefer to find a solution for generating printed reports more easily. Opened docs/tickets/54.