Thursday, December 18, 2014¶
TypeError: detail_handler is undefined¶
This came because notes.Notes was (1) visible only to admin and (2) used as the model’s default table.
Background: When creating a row,
CreateRow (or to be more precise,
CreateRow which inherits
from it) call
ar.goto_instance in order to display
the newly created row. And
ar.goto_instance needs the model’s
default table to specify the detail handler. You might ask why it
doesn’t simply take the detail handler defined on the table where it
was called. Good question, but we’ll dive into this another time. I
think it is because we want it to work transparently also in
situations where the calling table is not known…
First of all, the detail of a Note should be visible to everybody, not only to Admin. But the table of all notes, available viashould remain admin-only. Until now we used notes.Notes for this command. Since there is no other candidate for the default table, we define a new table notes.AllNotes with user_level=admin and use this table for the Explorer menu command. And notes.Notes remains there as the mother of all notes tables, but not directly used.
And secondly, if we would have wanted an admin-only detail, that’s not a reason for Lino to produce such strange behaviour.
ar.goto_instancemust test whether the detail_action has view permission before demanding to use it. This test is actually done in the object’s
And thirdly, I defined a new table
about.DetailLayoutsand added a section “List of detail layouts” to General overview of Lino Welfare in to make these subtleties visible.
Updated the docs for
Added new application setting
keep_erroneous_cache_files. Some time ago I had commented out the call to
os.removebecause I had that rather rare situation of wanting to see the partly generated chache file, and I forgot to reactivate that line of code after having fixed the problem.
Now I had this
Added a new role
messagefor marking up the message when writing text as the previous paragraph. (I thought it would be easy to have this message then also appear in the main documentation index so that a future victim of this problem has more chances to find the solution. But after some trying I gave up for this time.)