From a29aa7bab20c50639ed25d12e284178b413c0903 Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Fri, 4 Mar 2011 02:59:11 +0000
Subject: [PATCH] CompilerError used to be defined in
 Products.PageTemplates.TALES in Zope 2.8, so try to import it first and
 fallback on zope.tales.tales for Zope 2.12.

This fixes failures of testDynamicClassGeneration on Zope 2.8.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43957 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Utils.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Type/Utils.py b/product/ERP5Type/Utils.py
index 2d3c9409dd..34d95cec47 100644
--- a/product/ERP5Type/Utils.py
+++ b/product/ERP5Type/Utils.py
@@ -1280,7 +1280,12 @@ def createExpressionContext(object, portal=None):
   tv[cache_key] = ec
   return ec
 
-from zope.tales.tales import CompilerError
+# CompilerError used to be defined in Products.PageTemplates.TALES in
+# Zope 2.8
+try:
+  from Products.PageTemplates.TALES import CompilerError
+except ImportError:
+  from zope.tales.tales import CompilerError
 
 def evaluateExpressionFromString(expression_context, expression_string):
   """
-- 
2.30.9