Wednesday, December 25, 2019¶
I had an AttributeError: 'TableHandle' object has no attribute
'store'
traceback on an Lino Amici production site. It went away after
reload_services_sh
. So it was maybe the same reason as #3178.
The problem with that ticket is that we cannot reproduce it.
This time the traceback helped me to understand a bug in
lino.core.actors.Actor._get_handle()
:
@classmethod
def _get_handle(self, ar, hname):
h = self.__dict__.get(hname, None)
if h is None:
h = self._handle_class(self)
setattr(self, hname, h)
settings.SITE.kernel.setup_handle(h, ar)
return h
What happens when an exception occurs during setup_handle()
? This method
should not store the handle instance in that case. Because the exception is
caught by calling code, so the unfinished handle remains in memory and gets used
by subsequent calls, causing tracebacks like the above one. Now the
setattr()
is being called after setup_handle()
. I have some hope
that this might fix ticket #3178.
En passant I removed the lino.core.site.Site.setup_layouts()
methods
because AFAICS it isn’t used anywhere any more.