Hi all,

While using templates to produce something other than HTML (latex by
the way), I wanted to use my own escape function, instead of the
HTML-oriented default in autoescape.

This is of course not too difficult with filters and turning of
autoescape, but it would be very nice if I could get the autoescape
framework to use my own custom escape function. I found a ticket
(#14057, [1]) that was requesting the same thing, but was closed as
wontfix. A reason for doing this was that the change would a) require
lots of difficult changes and b) not be backwards compatible. Luke
left the door open for a "beautiful patch" to rescue the ticket and I
wonder if what I'm about to suggest would be enough.

Could a callable be passed to Context() in the autoescape parameter,
in order to define a custom escape function?

I've attached a simple patch to the ticket [2] and would be happy to
write tests and documentation if this approach is enough to overcome
the "wontfix". Have I overlooked something?

Cheers,

Will

[1] http://code.djangoproject.com/ticket/14057
[2] 
http://code.djangoproject.com/attachment/ticket/14057/14057-context-parameter.diff

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@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.

Reply via email to