Wednesday, May 27, 2015

Continued on #143. First modules lino_welfare.modlib.accounting and lino_welfare.modlib.finan show that I don’t need to worry about #246 for the moment.

There was a problem #284 (ar.show() renders to console and not to document) which intrigued me some time. One reaction was that I moved the get_printable_context() method from lino.core.site.Site to lino.core.requests.BaseRequest, and the get_printable_context on a model instance now gets the action request ar as mandatory positional argument.

While this was nice, it did not bring a solution.

The solution was to remove the following usage example from the docstring of lino.core.requests.BaseRequest.show():

do text
from html(ar.show('users.UsersOverview'))

This example had worked once, but broke some time ago. And I meanwhile think that it was not a good idea. Rendering a table into an appy.pod template is done using the table function defined by lino.utils.appy_pod.Renderer:

do text
from table(ar.spawn('users.UsersOverview'))

All this should be documented somewhere below Printing documents.

The ar in an appy.pod template represents the action request which asked for building the document. This request can have either a html renderer or a console renderer.