Thursday, January 24, 2019

I started the German user guide for Lino Così. The result of my work is published on http://de.cosi.lino-framework.org (I can also refer to it using intersphinx: Lino Così Benutzerhandbuch).

Working on caused some optimizations in layouts and field namings:

The field lino_xl.lib.contacts.Role.type had a verbose name “Role” which was useless and irritating because “Function” is clear enough and the same word as in Configure ‣ Contacts ‣ Functions.

In lino_book.projects.apc the hide_region setting is now True.

Lino Così now hides the fields street_box and street_prefix of a partner.

I changed the verbose name for lino.modlib.printing.BuildMethods from “Build method” to “Print method”

memo command inserts a newline when rendering Django objects

I tried to find the explanation for #2813.

>>> from lino import startup
>>> startup('lino_book.projects.team.settings.demo')
>>> from lino.api.doctest import *
>>> from io import StringIO
>>> from etgen.html import E
>>> from lxml import etree
>>> a = E.a("foo", href="bar")
>>> print(etree.tostring(a))
<a href="bar">foo</a>
>>> html_parser = etree.HTMLParser()
>>> ar = rt.login("robin")
>>> s = ar.parse_memo("""See [company 100 Jack]""")
>>> print(s)
See <a href="Detail">Jack</a>
>>> tree = etree.parse(StringIO(s), html_parser)
>>> for e in tree.iter():
...     print(etree.tostring(e))
<html><body><p>See <a href="Detail">Jack</a></p></body></html>
<body><p>See <a href="Detail">Jack</a></p></body>
<p>See <a href="Detail">Jack</a></p>
<a href="Detail">Jack</a>

Aha, the bug was in lino_xl.lib.blogs.LatestEntries.get_table_summary(). Seems that I didn’t understand very well what lxml.etree.parse().iter() does when I wrote this code:

elems.extend(tree.iter())

I actually wanted:

elems.append(tree.getroot())