[Zope-dev] Zope 2.12 20% slower than Zope 2.9?!

Chris Withers chris at simplistix.co.uk
Mon Oct 11 16:54:39 EDT 2010


On 11/10/2010 16:53, David Glick wrote:
>> Are there any docs on how to get Chameleon to work with classic,
>> ZODB-based page templates?
> Just use cmf.pt: http://pypi.python.org/pypi/cmf.pt

Ah, okay, well, I'm not using anything CMF, so I opted for just five.pt.

Unfortunately, this hits a unicode problem. The unicode problem I solved 
with an IUnicodeEncodingConflictResolver using the normal page template 
engine:

class Resolver:

     implements(IUnicodeEncodingConflictResolver)

     def resolve(self, context, text, expression):
         return unicode(text,'latin-1')

chameleon doesn't appear to use this, so I get:

   File "five.pt-1.3.3-py2.6.egg/five/pt/patches.py", line 90, in 
call_template_and_wrap
     return template(self, *args, **kw)
   File "z3c.pt-1.2.1-py2.6.egg/z3c/pt/pagetemplate.py", line 145, in 
__call__
     return bound_pt(*args, **kwargs)
   File "z3c.pt-1.2.1-py2.6.egg/z3c/pt/pagetemplate.py", line 262, in 
__call__
     return self.im_func(**kw)
   File "z3c.pt-1.2.1-py2.6.egg/z3c/pt/pagetemplate.py", line 136, in render
     return self.render(**context)
   File "Chameleon-1.2.13-py2.6.egg/chameleon/zpt/template.py", line 17, 
in render
     return super(PageTemplate, self).render(*args, **kwargs)
   File "Chameleon-1.2.13-py2.6.egg/chameleon/core/template.py", line 
221, in render
     return self.cook_and_render(kwargs, utils.emptydict, None, True)
   File "Chameleon-1.2.13-py2.6.egg/chameleon/core/template.py", line 
205, in cook_and_render
     return func(econtext, rcontext)
    - __traceback_info__: (<BaseTemplate >,)
   File "<string>", line 79, in render
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa3 in position 0: 
unexpected code byte

What's the chameleon or z3c.pt way of dealing with this*?

Chris

*'this' is stacks of ZODB-based page templates whose source may well be 
latin-1 encoded but, moreover, which are operating on a bunch of content 
that's *definitely* latin-1 encoded...
-- 
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope-Dev mailing list