Debugging generated ExtJS Javascript code

lino_XXX_yy.js
linoweb.js

At server startup the lino.modlib.extjs (or lino_extjs6.extjs) front end generates a series of files named lino_XXX_yy.js which contain the client side application logic. The first part of this file comes from a file lino/modlib/extjs/linoweb.js, the second part is generated from your models, tables, layouts and actions.

When you modified your copy of linoweb.js in order to debug it, there are some pitfalls:

A first pitfall is that when you modify linoweb.js, your development server does not automatically restart. This is because it watches only the .py files for changes. A development server constantly watches the timestamps of all Python source files and reloads itself automatically if something has changed. This is a convenient feature of Django which BTW works only in a developement server, not e.g. when serving your site on a production server. Actually Django's runserver command also detects changes in Django templates, but linoweb.js is not a Django template.

A quick workaround is to touch the timestamp of a Python file:

$ touch manage.py

A second pitfall is that when the process restarted, Lino does not yet create the lino_XXX_yy.js file. You must first hit Ctrl-R in your browser and watch for a next message in the Python console:

INFO Building /lino_cache/team/media/cache/js/lino_000_en.js ...

This is because Lino by default generates the Javascript cache file lazily, i.e. only when there is an incoming request. You can change this behaviour by setting build_js_cache_on_startup to True. But when debugging this is not convenient because it causes Lino to generate all Javascript files (one file per user type and language), which can take quite some time.

And then there is a third pitfall! Lino does not correctly detect every code source change. This is probably a bug. Lino seems to watch only the source of those modules which were loaded when the kernel started to startup. Observe the code_mtime attribute of lino.core.kernel.Kernel for details. But that bug is not important to explore since it occurs only on a development server.

In case of doubt, just watch whether the message INFO Building /lino_cache/.../media/cache/js/lino_000_en.js comes when you hit Ctrl-R. If it doesn't, then touch another code file.

lino.css

The ExtJS