[Repoze-dev] [issue156] Chameleon - Bugs when using with apache

2010-07-21 Thread tm128

New submission from tm128 :

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 = ''+body+''
PageTemplate.__init__(self, body, *args, **kwargs)

part = T('''10,- 
€''')
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\nreturn 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\nreturn 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\nsource = 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\nraise
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\nreturn 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\nreturn 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\nreturn func(econtext, rcontext)
  File "", 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__\nraise 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 

__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] [issue156] Chameleon - Bugs when using with apache

2010-07-21 Thread Malthe Borch

Malthe Borch  added the comment:

I'm not sure what this is, but it's not the first report I get about it.

It's difficult to debug without some way of reproducing it consistently, 
although it 
seems to revolve around thread-safety.

One thing about it though is that you seem to be compiling at run-time, 
repeatedly. That's not a good idea. Either use a template loader object, or 
define 
your template object on module- or class level.

Can you try to see if this changes anything?

--
status: unread -> chatting

__
Repoze Bugs 

__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev