New submission from tm128 <developm...@e-ventis.eu>:

When I use chameleon to render tal-snippets in table-cells of my tablehodler, i 
use

class T(PageTemplate):
    
    def __init__(self, body, *args, **kwargs):
        body = '<html tal:omit-tag="">'+body+'</html>'
        PageTemplate.__init__(self, body, *args, **kwargs)

part = T('''<b tal tal:content="python:'%d,-&nbsp;&euro;'%price">10,- 
&euro;</b>''')
dataDict = {'price':100}
part.render(**dataDict)

Under apache it works fine for a while, but after some time (perhaps every
apache-server-thread is used once) it throws following exceptions:

  File
"/usr/lib/python2.4/site-packages/Chameleon-1.2.10-py2.4.egg/chameleon/zpt/template.py",
line 17, in render\n    return super(PageTemplate, self).render(*args, **kwargs)
  File
"/usr/lib/python2.4/site-packages/Chameleon-1.2.10-py2.4.egg/chameleon/core/template.py",
line 209, in render\n    return self.cook_and_render(kwargs, utils.emptydict,
None, True)
  File
"/usr/lib/python2.4/site-packages/Chameleon-1.2.10-py2.4.egg/chameleon/core/template.py",
line 171, in cook_and_render\n    source = self.compiler(macro, global_scope)
  File
"/usr/lib/python2.4/site-packages/Chameleon-1.2.10-py2.4.egg/chameleon/core/translation.py",
line 1044, in __call__\n    _globals.append(
  File "/usr/lib64/python2.4/copy_reg.py", line 69, in _reduce_ex\n    raise
TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle function objects

If i patch this line with a try and except. It works for a while, but after that
I get following exception:

  File
"/usr/lib/python2.4/site-packages/Chameleon-1.2.10-py2.4.egg/chameleon/zpt/template.py",
line 17, in render\n    return super(PageTemplate, self).render(*args, **kwargs)
  File
"/usr/lib/python2.4/site-packages/Chameleon-1.2.10-py2.4.egg/chameleon/core/template.py",
line 209, in render\n    return self.cook_and_render(kwargs, utils.emptydict,
None, True)
  File
"/usr/lib/python2.4/site-packages/Chameleon-1.2.10-py2.4.egg/chameleon/core/template.py",
line 193, in cook_and_render\n    return func(econtext, rcontext)
  File "<string>", line 241, in render
  File
"/usr/lib/python2.4/site-packages/Chameleon-1.2.10-py2.4.egg/chameleon/core/utils.py",
line 332, in __getitem__\n    raise NameError(key)
NameError: _re_amp

If i restart apache every thing works well again, but only for a while.

Thanks for your help.

----------
assignedto: malthe
messages: 430
nosy: malthe, tm128
priority: bug
status: unread
title: Chameleon - Bugs when using with apache

__________________________________
Repoze Bugs <b...@bugs.repoze.org>
<http://bugs.repoze.org/issue156>
__________________________________
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to