I don't know if anyone will find this useful, but I thought I'd throw
it out there.
I wrote a little Middleware class to strip trailing and leading
whitespace from a response:
import re
class StripWhitespaceMiddleware:
"""
Strips leading and trailing whitespace from response content.
On 7/27/06, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> I don't know if anyone will find this useful, but I thought I'd throw
> it out there.
>
> I wrote a little Middleware class to strip trailing and leading
> whitespace from a response:
Hey Doug,
Thanks for contributing this! If you could, pos
Doug Van Horn wrote:
> I wrote a little Middleware class to strip trailing and leading
> whitespace from a response:
I may be misunderstanding something, but doesn't your middleware
actually leave whitespace at the beginning and end of the response?
If response.content = '\n\n\nHello.\n\n' it is
The intent is primarily to remove extra non-meaningful lines and
indents from the response. As an example:
{% for foo in foo_list %}
{{ foo }}
{% endfor %}
yields before middleware:
biz
baz
buz
and after middleware:
biz
baz
buz
It's nothing special, and if I've m
Doug Van Horn wrote:
> Hopefully that makes the intent more clear.
Yes, much more clear! For some reason, I thought you were only
concerned with whitespace at the beginning and end of the response.
Sorry for the trouble!
Will.
--~--~-~--~~~---~--~~
You receive
I never really liked how the templating system leaves all those
newlines. This middleware is cool, but it would really be nice if the
templating system could collapse the lines that only contain one or
more evaluating-to-nothing template tags.
Thoughts on a possible implementation:
What if an e
On Tue, 2006-08-01 at 22:53 -0700, Gary Wilson wrote:
> I never really liked how the templating system leaves all those
> newlines. This middleware is cool, but it would really be nice if the
> templating system could collapse the lines that only contain one or
> more evaluating-to-nothing templa
On 28 Jul 2006, at 17:41, Adrian Holovaty wrote:
On 7/27/06, Doug Van Horn <[EMAIL PROTECTED]> wrote:
I don't know if anyone will find this useful, but I thought I'd throw
it out there.
I wrote a little Middleware class to strip trailing and leading
whitespace from a response:
Hey Doug,
T
On 08/02/06 09:09, Malcolm Tredinnick wrote:
[...]
> My motivation here was having to debug an email generation template
> yesterday that was like a train wreck with all the template tags jammed
> together to avoid spurious blank lines. It's going to be a few more days
> before I can work on this
Hi Doug.you have to be careful when striping out whitespace, as sometimes it holds "value"stuff like _javascript_ and 'pre' tags shouldn't have whitespace stripped as you might change the look/behavior of the page.regardsIanOn 01/08/2006, at 1:43 AM, Doug Van Horn wrote:The intent is primarily to r
Howdy guys --
Just out of curiosity, have you tried using the {% spaceless %} tag?
What's it missing that you've needed to use middleware for?
(see http://www.djangoproject.com/documentation/templates/#spaceless)
Jacob
--~--~-~--~~~---~--~~
You received this m
Jacob Kaplan-Moss wrote:
> Howdy guys --
>
> Just out of curiosity, have you tried using the {% spaceless %} tag?
> What's it missing that you've needed to use middleware for?
>
> (see http://www.djangoproject.com/documentation/templates/#spaceless)
>
while talking about {% spaceless %}
12 matches
Mail list logo