Template processor forces a newline at the end of the output

Bug #218706 reported by Eleanor Berger on 2008-04-17
Affects Status Importance Assigned to Milestone
Launchpad itself
Zope 3
Fred Drake

Bug Description

The template processor inserts a newline \n character at the end of the output even if it's not there. In some cases, it is important that no such new line appears, but this result is currently impossible to achieve.


Changed in launchpad:
assignee: nobody → intellectronica
status: New → Confirmed
milestone: none → 1.2.4
Changed in launchpad:
milestone: 1.2.4 → 1.2.5
Matthew Paul Thomas (mpt) wrote :

For example, in mpt/launchpad/2008-05-translation, see <http://translations.launchpad.dev/evolution/trunk/+pots/evolution-2.2/es/+translate>. There should be only a 1px white line between the segments, not the current space caused by a line break.

description: updated
Steve Alexander (stevea) wrote :

The fix in Zope is needed in lib/zope/tal/talinterpreter.py, in __call__. These lines should be removed:

if self.col > 0:
    self.col = 0

The full discussion in the mailing list spans two months.


The code in question hasn't been touched in many months.


The catch, of course, is that we can't know if there's anyone that
relies on it for other reasons. I'd be happy to rip it out otherwise.

Removing that code causes many tests to break, and all the breakage
appears incidental rather than fundamental.

Would people be happy with the current behavior as a default, and a
way to set an attribute of the TALInterpreter instance to use the
cleaner behavior? An attribute on the page template object could then
be used to record the application's requirements.

Steve Alexander (stevea) wrote :

Fred, I don't think we need to tread so carefully. If we change this behaviour in a major release, and document the change in the release notes, I think that's enough. It's far easier to insert a newline into templates manually than to remove one that the libraries brokenly stick in.

Zope already suffers too much from excessive complexity to support backwards compatibility that almost no one uses.

This change is in line with the published TAL spec. I think the current behaviour is counter-intuitive and arguably taking a great liberty with the TAL spec, in introducing extra characters.

I very much support updating the tests to not have extra new-lines and updating the code, and documenting the change in the change notes, and releasing this.

Christian Reis (kiko) wrote :

Fred, c'mon, if not just for Launchpad, let's do it for the kittens. <wink>

Changed in launchpad:
milestone: 1.2.5 → none
Fred Drake (fdrake) wrote :

Fixed in subversion revision 87220.

Tested with Python 2.4.4, 2.5.2.

Released in zope.tal 3.5.0 (http://pypi.python.org/pypi/zope.tal/3.5.0/).

Changed in zope3:
assignee: nobody → fdrake
status: New → Fix Released
Curtis Hovey (sinzui) on 2009-10-09
tags: added: tech-debt
Curtis Hovey (sinzui) on 2010-06-01
Changed in launchpad-foundations:
assignee: Tom Berger (intellectronica) → nobody
Curtis Hovey (sinzui) on 2010-11-13
Changed in launchpad-foundations:
status: Confirmed → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers