Django templates error after recent django upgrade.

Sam Ruby rubys at intertwingly.net
Fri Jul 6 05:02:24 EST 2007


On 7/5/07, Amit Chakradeo (अमित चक्रदेव) <chakradeo+planet at gmail.com> wrote:
> Hi all,
>
>    I found that splice.py fails when using django template (and when django
> codebase is updated (the big unicode branch merge!)).
>
>   Here is a quick patch for planet/shell/dj.py to fix this problem:
>  43c43
>  < f.write(t.render(context))
>  ---
>  > f.write(t.render(context).encode('utf-8′))
>
> Sam, would it be possible to merge this fix into your tree ? (I need to
> setup my own bzr tree soon :)

Done.

> Thanks!
> Amit
> http://amit.chakradeo.net/2007/07/05/django-unicode-integration-fix-for-venus-djando-template/
>
>
> ---------- Forwarded message ----------
> On 05/07/07, Amit Chakradeo (अमित चक्रदेव) < chakradeo at gmail.com> wrote:
> > Gee, found it. Sorry for multiple emails:
> >
> > The code around line 43 of shell/dj.py should read
> >
> >         f = open(output_file, 'w')
> >         f.write(t.render(context).encode('utf-8'))
>
> Hi Amit, could you submit that patch to Sam for inclusion? My own
> working copy is rather out of date at the moment and I don't have time
> to fix it quickly.
>
> Thanks for the fix anyway!
> --
> Antonio
> From: Amit Chakradeo (अमित चक्रदेव) <chakradeo at gmail.com>
> Date: Jul 5, 2007 7:47 AM
> Subject: Re: Config item for Django templates
> To: Antonio Cavedoni < antonio at cavedoni.org>
>
> Hi Antonio,
>
>    I am using your django template for venus. I upgraded the django code
> yesterday from svn (biggest change for me is the unicode branch merge).
> Unfortunately it has killed all of my 'planet's. I am trying to locate the
> problem, but am just giving you a heads up to see if you can find a fix
> quicker...
>
> Here is where it fails:
> [philyra] ~/planet/venus > python splice.py  ../c2.ini
> Traceback (most recent call last):
>   File "splice.py", line 15, in ?
>     splice.apply(doc.toxml('utf-8'))
>   File "/home/spacefra/planet/venus/planet/splice.py", line
> 118, in apply
>     output_file = shell.run(template_file, doc)
>   File
> "/home/spacefra/planet/venus/planet/shell/__init__.py",
> line 66, in run
>     module.run(template_resolved, doc, output_file, options)
>   File "/home/spacefra/planet/venus/planet/shell/dj.py",
> line 43, in run
>     f.write(t.render(context))
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position
> 2941: ordinal not in range(128)
>
> Thanks!
> Amit
>
>
>
> On 3/1/07, Antonio Cavedoni < antonio at cavedoni.org> wrote:
> > Hello there,
> >
> > I implemented yet another minimal change to my copy of Venus. This
> > time it's the ability (kindly suggested by Amit Chakradeo) to "see"
> > the Planet's config variables from within the Django templates.
> > Amit's use case was to insert his Google Analytics code in the .ini
> > file and print it in the templates, but I'm sure it might be useful
> > in other situations. The new template item is called "Config".
> >
> > I also added a unit test and some docs for this feature, it's all on
> > my Venus branch together with the other patches I posted last week:
> >
> > http://cavedoni.com/2007/02/venus/
> >
> > Cheers.
> > --
> > Antonio
> >
> >
> > --
> > devel mailing list
> > devel at lists.planetplanet.org
> > http://lists.planetplanet.org/mailman/listinfo/devel
> >
>
>
> --
> devel mailing list
> devel at lists.planetplanet.org
> http://lists.planetplanet.org/mailman/listinfo/devel
>
>


More information about the devel mailing list