Tuesday, July 5, 2016

Community work

I merged Hamza’s work on #946 into the master of Lino Noi and added a test case to tickets (Ticket management in Noi).

I noticed that builds for Lino Noi on Travis are failing for a very stupid reason: because Lino Extensions Library has never been released to PyPI. So I now released version 1.0.0 of Lino Extensions Library. Changelog for this project are together with The lino package and Developer Guide.

The project settings on drone.io were still configured for using fab instad of inv. Now they are failing (at least) because the latest Lino is not released. But I leave this waiting because I started working on #1017.

Notifications framework

For #1017 we “just” want to extend Lino’s notification framework so that the actual sending of emails is done in a separate job.

  • The notify.Notification.notify method should no longer call send_email.

  • lino.modlib.notify.models must define a task which calls send_email on every unsent notification.

  • Register that task to be run every 10 seconds. The schedule package seems interesting for this.

  • Write a daemon command linod which runs all scheduled tasks.

Since the last two items will probably be interesting for other plugins as well, they should be in a central place (and not in the lino.modlib.notify plugin).

We have lino.utils.daemoncommand which worked well for watch_tim (until they migrated from TIM to Lino and no longer needed to synchronize them). But it needs to be converted from optparse to argparse.

Code changes:

  • New model mixin lino.modlib.notify.mixins.Observable. lino_noi.lib.tickets.models.Ticket and lino.modlib.comments.models.Comment are the first usage.

  • lino.modlib.notify is the first usage of the schedule package: it registers two handlers send_pending_emails() and clear_seen_notifications().

  • New admin command linod. On a development machine you simply run this in a separate terminal. On a production server this should be installed as a service (starting a new process every 10 seconds would probably cause a big server load).

  • I revised both the database structure and the API for the notification framework.

Which also resulted in a great progress for #932 (Make the comments system in Noi usable).

Bleached comments

About #1022: I stumbled over the probabele explanation: I guess that our observation was because bleach was not installed or not active. See source code of lino.modlib.comments.models.

I added ol, ul and li to lino.modlib.comments.models.Comment.ALLOWED_TAGS because these tags seem harmless.

Commit

I commited my changes to master and pushed them though some test suites are probably broken.