Sunday, December 5, 2010

Re: UTF-8 support in custom tags

The exception occurred before this statement, but I changed it anyway.
Thanks.


---
Maxim

On Dec 5, 4:58 pm, Ramiro Morales <cra...@gmail.com> wrote:
> On Sun, Dec 5, 2010 at 4:23 AM, Maxim <smartma...@gmail.com> wrote:
> > Hi Ramiro,
>
> > Thanks for tip. Setting
>
> > DEFAULT_CHARSET = "UTF-8"
> > FILE_CHARSET = "UTF-8"
>
> > did the trick, though I thought it is UTF-8 by default and doesn't
> > have to be set explicitly.
>
> Should have pointed to the more specific subsection of the docs
> (http://docs.djangoproject.com/en/1.2/ref/unicode/#template-tags-and-f...),
> sorry:
>
> "A couple of tips to remember when writing your own template tags and filters:
> Always return Unicode strings from a template tag's render() method and from
> template filters."
>
> So maybe you simply should make sure you return u"" instead of ""
> from your render() method ?:
>
> >> >  def render(self, context):
> >> >    context[self.variable] = self.nodelist.render(context)
> >> >    return ""
>
> --
> Ramiro Morales

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate