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

2013-12-17 Thread Tres Seaver

Tres Seaver  added the comment:

Please report / track Chameleon issues on Github:

  https://github.com/malthe/chameleon/issues

--
status: chatting -> deferred

__
Repoze Bugs 

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


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

2010-07-22 Thread Malthe Borch

Malthe Borch  added the comment:

> Is there a solution for dynamic template-strings? It seems to work, but i 
> am not sure what happens, if template changes.

If you change the ``body`` attribute, then the template will be automatically 
recompiled.

With regards to setting a template cache, this shouldn't be necessary. Try 
setting 
``debug=False`` (if it's true).

__
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-22 Thread tm128

tm128  added the comment:

Am 21.07.2010 15:34, schrieb 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.
>

Thank you for your quick reply. I played around a few hours.
I ran the same application under zope and it works without problems.
> 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.
>

My tal-snippets is stored in sql-database and is compiled at runtime. It is a
feature not a bug.

I had a look at source of template-loader and it looks like it works only with
files in filesystem.

I tried also do define a template on module level. It has now effekt, same 
error.

But i found a temporary solution, "patching" zpt.PageTemplate

"""

from chameleon.zpt.template import PageTemplate as BaseClass
from chameleon.core import filecache

class PageTemplate(BaseClass):

def __init__(self, body, *args, **kwargs):
body = ''+body+''
super(PageTemplate, self).__init__(body, *args, **kwargs)
self.registry = filecache.TemplateCache( '/tmp/mytempcache', 0)

"""

Is there a solution for dynamic template-strings? It seems to work, but i am not
sure what happens, if template changes.

__
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


[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