Skip to content

v0.3.1 — Notification accepts body content

Choose a tag to compare

@fsecada01 fsecada01 released this 02 Aug 00:59
· 8 commits to master since this release
a361304

A patch for one bug, shipped on its own because of how it fails.

Notification discarded body content in every theme and both engines, and in django-cotton it did so silently — no error, no warning, and a call site that reads correctly. Anyone using the natural container form has been getting a correctly styled, correctly coloured, empty box, with nothing in their own code or logs to say so. This predates 0.1.1, so every release to date is affected.

Upgrade if you pass children to <c-cf.notification> or <Cf:Notification>. If every call site passes message=, nothing changes for you.

{# rendered an empty box before 0.3.1 #}
<c-cf.notification type="danger" dismissible="false">
  <strong>{{ error }}</strong>
</c-cf.notification>

Fixed — Notification silently discarded its body content (#65)

  • Body content now renders in all ten templates — five themes × two engines — falling back to the scalar message when no body is given. message= callers are untouched; the JinjaX signature only loosens (message required → optional) and the cotton wrapper only gains a <c-vars> default. No migration.
  • A body that renders to nothing is not a body. django-cotton hands the partial its nodelist output verbatim, so a paired tag whose body renders empty still supplies "\n " — truthy. Without a guard, a message= caller writing a conditional body would get an empty box on the false branch, which is the same bug with a new trigger. Both engines treat a whitespace-only body as absent.
  • The two content channels want opposite escaping and now get it, under test. JinjaX wraps slot content in Markup, so a body passes through the template's {% autoescape true %} block untouched, while message is caller-supplied text and stays escaped. Both halves are asserted per theme rather than left to autoescape semantics.
  • Foundation's <p> now wraps message alone. Broadening the content channel made an existing wrapper wrong: the HTML parser closes an open paragraph on block content, so <p><ul>…</ul></p> parses to <p></p><ul>…</ul><p></p>, reparenting the body onto .callout and leaving two empty paragraphs for Foundation's own .callout > :first-child / > :last-child margin rules to match. The scalar form renders byte-identically to 0.3.0. Fomantic's <div class="content"> and bootstrap/daisy's <span> hold block content without being restructured, and are unchanged.
  • Covered at the tier that could have caught it. The bug survived because no test tier that ran the django-cotton compiler looked at this component's content channel: the unit tier injects slot as raw context, and the integration tier does not install django_cotton at all. The three cotton call forms are now asserted in E2E, where slot is built by cotton itself.

Full changelog: v0.3.0...v0.3.1