[Django] #25529: Cannot use filters for plain text templates due to non-breaking spaces between values and units

9 views
Skip to first unread message

Django

unread,
Oct 8, 2015, 6:03:17 AM10/8/15
to django-...@googlegroups.com
#25529: Cannot use filters for plain text templates due to non-breaking spaces
between values and units
---------------------------------+---------------------
Reporter: quantoid | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: 1.8
Severity: Normal | Keywords: filters
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+---------------------
#20246 added `\xa0` characters between numbers and units in various
filters like `timesince`.

This means you can't easily use these filters in templates that generate
plain text content, e.g. text that you want to send to another service as
part of handling a request.

We need a way to turn off those non-breaking spaces in the filters that
use them.

--
Ticket URL: <https://code.djangoproject.com/ticket/25529>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 8, 2015, 6:04:46 AM10/8/15
to django-...@googlegroups.com
#25529: Avoid non-breaking spaces between values and units when using filters in
plain text templates
---------------------------------+--------------------------------------

Reporter: quantoid | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: 1.8
Severity: Normal | Resolution:

Keywords: filters | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by quantoid):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/25529#comment:1>

Django

unread,
Oct 8, 2015, 6:25:19 AM10/8/15
to django-...@googlegroups.com
#25529: Avoid non-breaking spaces between values and units when using filters in
plain text templates
---------------------------------+--------------------------------------
Reporter: quantoid | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: 1.8
Severity: Normal | Resolution:

Keywords: filters | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by claudep):

Sorry, but it's not very clear to me why you couldn't have non-breaking
spaces in plain text. Could you elaborate a bit?

--
Ticket URL: <https://code.djangoproject.com/ticket/25529#comment:2>

Django

unread,
Oct 9, 2015, 2:50:50 AM10/9/15
to django-...@googlegroups.com
#25529: Avoid non-breaking spaces between values and units when using filters in
plain text templates
---------------------------------+--------------------------------------
Reporter: quantoid | Owner: nobody
Type: New feature | Status: closed

Component: Template system | Version: 1.8
Severity: Normal | Resolution: worksforme

Keywords: filters | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by claudep):

* status: new => closed
* resolution: => worksforme


Comment:

Please reopen if you can show your issue corresponds to a common use case.
Otherwise, I think it wouldn't be hard to create your own template filter
(`to_ascii`?) and chain with the appropriate filters (might also be
implemented by a custom response middleware).

--
Ticket URL: <https://code.djangoproject.com/ticket/25529#comment:3>

Reply all
Reply to author
Forward
0 new messages