Re: Zope 2.12 20% slower than Zope 2.9?!

Chris Withers <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
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
_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.