====================== Sunday, March 22, 2015 ====================== I continued to work on :mod:`lino.modlib.checkdata`. Managing data problems using the web interface ====================================================== Users are now able to fix problems using the web interface: the "Bell" button is now a combobutton with two actions :class:`UpdateMessages ` and :class:`FixProblems `. The :class:`Messages ` table is now read-only. Detail window on a ChoiceList ============================= Cool! The :class:`Checkers ` table now has a detail window where you can admire the :class:`MessagesByChecker ` table. This required two subtle new features: - Lino now supports a :attr:`detail_layout ` on a :class:`ChoiceList `. - Lino now supports slave tables whose master is a :class:`lino.core.choicelists.Choice`. General side effects: - I removed the warning message :message:`Failed to set excerpts actions` which was logged by :func:`lino.modlib.excerpts.models.set_excerpts_actions`. - Updated documentation. TODO: - Rename `lino.modlib.plausability` to `lino.modlib.checkdata`? Not now. One good thing is that "plausability" rimes with "integrity". Note that this has nothing to do with Django's `System check framework `_? Lino and Django 1.7 =================== Mahmoud and I had a 3 hours extreme programming session on ticket :ticket:`38`. Here are some traces of what we did. I started a new section of the Developers Guide: :lino:`/dev/i18n`. We tested this document using:: $ python -m doctest docs/blog/2015/0322.rst Django 1.7 is more strict about the fact that translatable strings may not be translated while models are still loading. Which in first place means that you must `ugettext_lazy` and not `ugettext`. Lino accidentally still used the latter in one or two modules. I learned that lazy translatable strings (instances of `django.utils.translations.Promise`) are also being translated when code tests for their boolean value. For example: >>> from django.utils.translation import ugettext_lazy as _ >>> verbose_name = _("January") >>> verbose_name #doctest: +NORMALIZE_WHITESPACE +ELLIPSIS Now the following statement won't work unless the "internationlization machine" has been initialized: >>> s2 = verbose_name or "Month" #doctest: +NORMALIZE_WHITESPACE +ELLIPSIS Exception raised: Traceback (most recent call last): ... ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. But this is allowed: >>> if verbose_name is None: ... s2 = "Month" ... else: ... s2 = verbose_name Here an example: >>> import os >>> os.environ['DJANGO_SETTINGS_MODULE'] = 'lino.projects.min1.settings.demo' >>> from lino.api.shell import * >>> from lino.core.kernel import choicelist_choices >>> choicelist_choices() #doctest: +NORMALIZE_WHITESPACE +ELLIPSIS [('cal.AccessClasses', 'AccessClasses'), ('cal.DurationUnits', 'DurationUnits'), ('cal.EventEvents', ), (u'cal.EntryStates', ), ... ('users.UserProfiles', )]