20121127
========

Monitoring a Lino site
----------------------

Lino should be able to send every day a 
monitor status to the admins of a site.
The first useful thing in such a status seems 
to be certain warnings:

- if the size on disk or number of records of a model has grown abnormally
- available disk space and size of log files

:mod:`lino.management.commands.diag` is not the right candidate 
to do this job (main purpose is a logical comparison of two dumps),
so we write a new command for this:
:mod:`lino.management.commands.monitor`.

How to find out the disk size 
used by the database table of each model?

- Currently only for the mysql backend. 

- PostGreSQL should be easy, too. 

- sqlite would be more tricky (https://stackoverflow.com/questions/5900050/sqlite-table-disk-usage) 
  and probably never necessaary.
  
Okay, here is some first visible result::  
  
  luc@vps:~/mypy/demo_sites/welfare$ python manage.py  monitor
  INFO Loaded 2 states from /home/luc/mypy/demo_sites/welfare/states.pck
  INFO Changes since 2012-11-27 08:34:50.240809:
  - cv.LanguageKnowledge rows : 122 -> 121
  - cv.LanguageKnowledge bytes : 10992 -> 10972
  INFO Saved 3 states to /home/luc/mypy/demo_sites/welfare/states.pck  
  
But there's still a lot to do. Not urgent.


Bugfixes
--------

- There was a bug in :meth:`lino.Lino.is_installed`: `is_installed('lino')` 
  always returned False.
  This caused `UserProfiles` to lack in the definition of global 
  choicelists in `lino*.js`.
  
- When using :attr:`lino.Lino.remote_user_header` 
  it was possible to authenticate as a user whose `profile` was empty.
  This then caused a message "AttributeError. 'NoneType' object has no attribute 'level'".
  Now the message is "Unknown or inactive username 'nicole'. 
  Please contact your system administrator."


Hidden columns
--------------

The new attribute :attr:`lino.core.model.Model.hidden_columns` 
makes it more pleasant to define hidden columns. 
If specified, this is the default value for 
:attr:`lino.core.dbtables.Table.hidden_columns` 
of every  :class:`lino.core.dbtables.Table` on this model.

:class:`lino_welfare.modlib.isip.ContractBase`
and :class:`lino_welfare.modlib.isip.Contract`
are usage examples.

Managers may edit other user's work...
--------------------------------------

The new attribute 
:attr:`lino.mixins.UserAuthored.manager_level_field` 
is to solve a subtle problem. See docstring.
Used on :class:`lino_welfare.modlib.isip.ContractBase`
Managers may edit other user's work...

Miscellaneous
-------------

- :menuselection:`Explorer --> ÖSHZ --> ClientStates`

- When trying to render something as pdf on any of the demo sites, 
  (e.g. clicking the [pdf] button at http://demo1.lino-framework.org/api/polls/Polls),
  the server said "An error occurred during the conversion. 
  Doc URL "/home/luc/mypy/demo_sites/polls/media/cache/appypdf/polls.Polls.pdf.1354022098.282635/result.odt" 
  is wrong. URL seems to be an unsupported one."
  
  That was just because forgot to install openoffice-writer on the server.
  Took me some time to discover the reason, though.
  Thanks to https://stackoverflow.com/questions/7377012/openoffice-api-url-seems-to-be-an-unsupported-one 
  for shedding light over this.

- Error while evaluating expression "settings.LINO.site_version()". 
  cannot concatenate 'str' and 'NoneType' objects

- When trying to create a Posting from a Postable (e.g. a Note),
  the action failed and the server reported 
  "ValidationError {'state': [u'Dieses Feld darf nicht leer sein.']}"


- New class :class:`lino.modlib.contacts.utils.GenderItem` 
  with a method
  :meth:`mf <lino.modlib.contacts.utils.GenderItem.mf>`.
  
- `Lino-Welfare 1.0.4` pre-released