20111229

  • Wrote the migration handler lino.apps.dsbe.migrate.migrate_from_1_3_2() which sets the new build_time fields on existing data.

  • Added a new test “Overlapping contracts” to lino.apps.dsbe.models.Person.data_control(). On result is that the preview takes now quite some time and should be cached.

One surprise while working on the migration handler:

Problem installing fixture '/usr/local/django/dsbe_eupen/fixtures/d20111229.py': Traceback (most recent call last):
  ...
  File "/usr/local/django/dsbe_eupen/fixtures/d20111229.py", line 266, in lino_datacontrollisting_objects
    yield create_lino_datacontrollisting(1,True,None)
  File "/var/snapshots/lino/lino/apps/dsbe/migrate.py", line 908, in create_lino_datacontrollisting
    obj.build_time = obj.get_cache_mtime()
  File "/var/snapshots/lino/lino/mixins/printable.py", line 705, in get_cache_mtime
    filename = self.get_cache_filename()
  File "/var/snapshots/lino/lino/mixins/printable.py", line 701, in get_cache_filename
    bm = get_build_method(self)
  File "/var/snapshots/lino/lino/mixins/printable.py", line 453, in get_build_method
    bmname = elem.get_build_method()
  File "/var/snapshots/lino/lino/mixins/printable.py", line 694, in get_build_method
    return settings.LINO.config.default_build_method
AttributeError: 'Lino' object has no attribute 'config'

Explanation: the dpy fixtures are of course executed before any the kernel setup has been done. That’s why there was no config object jetzt in the lino.Lino instance. And the site’s lino.models.SiteConfig.default_build_method has not yet been restored.

Solution: new configuration parameter lino.Lino.site_config_defaults. And instead of setting a config instance variable during kernel setup, we now have a property site_config which lazily calls get_site_config.