Re: Proposal: Better HTML4 support

2009-09-27 Thread veena

Hi all,

my bits to discussion about supporting various (X)HTML versions.

1) Problem with (X)HTML in python code (in applications)
I discovered this python package http://pypi.python.org/pypi/html/1.6
It allows you to write "python like HTML syntax" and generates HTML or
XHTML.

2) Problem with (X)HTML in templates
I think there should be parser, which parse template just before
caching templates. Code could be messy HTML or (XHTML) or invalid HTML
(like undisclosed tags, attributes without quotations marks etc.) and
from this make pretty HTML or XHTML according to html coder settings
by {% doctype %}

The template post processing also enables to make code nicer indented
or flatten. Or even use as templating language something like REST,
textile etc.

The python packages that could be involved in parsing messy (X)HTML
and I know about them:
http://pypi.python.org/pypi/BeautifulSoup/3.0.7a
http://pypi.python.org/pypi/html5lib/0.10


Best,
Vaclav

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Proposal: Better HTML4 support

2009-09-27 Thread Simon Willison

On Sep 27, 10:49 am, veena  wrote:
> my bits to discussion about supporting various (X)HTML versions.
>
> 1) Problem with (X)HTML in python code (in applications)
> I discovered this python packagehttp://pypi.python.org/pypi/html/1.6
> It allows you to write "python like HTML syntax" and generates HTML or
> XHTML.

Something like that might be an option for cleaning up the way markup
is generated within the forms framework itself, but ultimately I think
adding an entirely new Python-based generation method just to output a
few strings wouldn't be worth the added dependency.

> 2) Problem with (X)HTML in templates
> I think there should be parser, which parse template just before
> caching templates. Code could be messy HTML or (XHTML) or invalid HTML
> (like undisclosed tags, attributes without quotations marks etc.) and
> from this make pretty HTML or XHTML according to html coder settings
> by {% doctype %}

The performance overhead rules out this kind of approach for Django
core - any post-processing run against the output of the templates
would be executed on every single Django request, and HTML parsing and
rewriting is a very expensive operation. That's not to say a third
party module couldn't be written to do this kind of thing for people
who really want to clean up their output (I remember there being an
HTMLTidy middleware a few years back that did this) but it wouldn't be
suitable for inclusion in core.

Cheers,

Simon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Adding signing (and signed cookies) to Django core

2009-09-27 Thread Simon Willison

I've started a project on GitHub to develop the signing
implementation:

http://github.com/simonw/django-signed

The TODO section in the readme shows the next things I'll be working
on.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---