Message4822
I was running the roundup using wsgi in twisted web(latest 12.3.0). When I created new project with jinja2 template engine, I got this exceptions.
Traceback (most recent call last):
File "/Volumes/Userland/Users/spikeekips/workspace/roundup/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.8-x86_64.egg/twisted/application/app.py", line 402, in startReactor
self.config, oldstdout, oldstderr, self.profiler, reactor)
File "/Volumes/Userland/Users/spikeekips/workspace/roundup/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.8-x86_64.egg/twisted/application/app.py", line 323, in
runReactorWithLogging
reactor.run()
File "/Volumes/Userland/Users/spikeekips/workspace/roundup/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.8-x86_64.egg/twisted/internet/base.py", line 1173, in run
self.mainLoop()
File "/Volumes/Userland/Users/spikeekips/workspace/roundup/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.8-x86_64.egg/twisted/internet/base.py", line 1182, in mainLoop
self.runUntilCurrent()
--- <exception caught here> ---
File "/Volumes/Userland/Users/spikeekips/workspace/roundup/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.8-x86_64.egg/twisted/internet/base.py", line 778, in runUntilCurrent
f(*a, **kw)
File "/Volumes/Userland/Users/spikeekips/workspace/roundup/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.8-x86_64.egg/twisted/web/wsgi.py", line 274, in wsgiWrite
self.request.write(bytes)
File "/Volumes/Userland/Users/spikeekips/workspace/roundup/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.8-x86_64.egg/twisted/web/server.py", line 220, in write
http.Request.write(self, data)
File "/Volumes/Userland/Users/spikeekips/workspace/roundup/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.8-x86_64.egg/twisted/web/http.py", line 980, in write
self.transport.writeSequence(toChunk(data))
File "/Volumes/Userland/Users/spikeekips/workspace/roundup/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.8-x86_64.egg/twisted/internet/_newtls.py", line 204, in writeSequence
FileDescriptor.writeSequence(self, iovec)
File "/Volumes/Userland/Users/spikeekips/workspace/roundup/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.8-x86_64.egg/twisted/internet/abstract.py", line 371, in writeSequence
raise TypeError("Data must not be unicode")
exceptions.TypeError: Data must not be unicode
This exception was caused, `Jinja2ProxyPageTemplate` does return the valid `unicode` instead of `str`, so I patched roundup like this.
diff -x '.*.swp' -x '*.txt' -uNr a/roundup/cgi/engine_jinja2.py b/roundup/cgi/engine_jinja2.py
--- a/roundup/cgi/engine_jinja2.py 2013-03-05 23:56:45.000000000 +0900
+++ b/roundup/cgi/engine_jinja2.py 2013-03-15 17:35:57.000000000 +0900
@@ -75,7 +75,7 @@
# [ ] limit the information passed to the minimal necessary set
c = context(client, self, classname, request)
c.update({'options': options})
- return self._tpl.render(c)
+ return self._tpl.render(c).encode(client.charset, )
def __getitem__(self, name):
# [ ] figure out what are these for
Thanks. |
|
Date |
User |
Action |
Args |
2013-03-15 08:48:22 | spikeekips | set | recipients:
+ spikeekips |
2013-03-15 08:48:22 | spikeekips | set | messageid: <1363337302.49.0.272991226257.issue2550800@psf.upfronthosting.co.za> |
2013-03-15 08:48:22 | spikeekips | link | issue2550800 messages |
2013-03-15 08:48:21 | spikeekips | create | |
|