From b541caecff9ecd14545ca16f9fe278c29fbaf4a3 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 4 Dec 2009 16:21:01 +0000 Subject: - Operation on GAE was broken, presumably because the ``repoze.bfg.configuration`` module began to attempt to import the ``repoze.bfg.chameleon_zpt`` and ``repoze.bfg.chameleon_text`` modules, and these cannot be used on non-CPython platforms. It now tolerates startup time import failures for these modules, and only raise an import error when a template from one of these packages is actually used. --- repoze/bfg/chameleon_text.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'repoze/bfg/chameleon_text.py') diff --git a/repoze/bfg/chameleon_text.py b/repoze/bfg/chameleon_text.py index b69e8fed0..50491a3d0 100644 --- a/repoze/bfg/chameleon_text.py +++ b/repoze/bfg/chameleon_text.py @@ -2,8 +2,20 @@ from webob import Response from zope.interface import implements -from chameleon.core.template import TemplateFile -from chameleon.zpt.language import Parser +try: + from chameleon.core.template import TemplateFile +except ImportError, why: # pragma: no cover + # Chameleon doesn't work on non-CPython platforms + class TemplateFile(object): + def __init__(self, *arg, **kw): + raise ImportError(why[0]) + +try: + from chameleon.zpt.language import Parser +except ImportError: # pragma: no cover + # Chameleon doesn't work on non-CPython platforms + class Parser(object): + pass from repoze.bfg.interfaces import IResponseFactory from repoze.bfg.interfaces import ITemplateRenderer -- cgit v1.2.3