On 11/18/06, can xiang <[EMAIL PROTECTED]> wrote:
>
> I'm trying to render template into XML output. If the str representation
> of the variable contains special character of XML, it would cause
> trouble. The same thing would happen if trying to render into CSV or
> other format.

The current solution would be to use a filter; for example, there is
an 'escape' filter to escape html special characters. You would need
to write a similar filter for the XML special character set.

> It would be nice if the render function of Template can take additional
> parameter to selectively encode the string according the XML entity
> reference or other spec. It means a patch of "encode_output" function of
> "VariableNode" may needed.

Interesting idea; however, there is at least one problem. How do you
handle occasions where you want the raw, unencoded value of a variable
node? In light of this, I'm not sure that the idea you are proposing
is significantly more elegant than manually escaping variables using a
filter.

Yours,
Russ Magee %-)

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

Reply via email to