[ZPatterns] Zope 2.4b1 and ZPatterns 0.4.3, bug and fix

Juan David Ibáñez Palomar palomar@sg.uji.es
Tue, 26 Jun 2001 11:01:26 +0200 (METDST)


Hi all,


With Zope 2.4b1 and ZPatterns 0.4.3, the following error raises when
starting Zope:

2001-06-26T08:24:40 ERROR(200) Zope Could not import Products.ZPatterns
Traceback (innermost last):
  File /home/jdavid/Zope-2.4.0b1/lib/python/OFS/Application.py, line 552, in import_product
  File /home/jdavid/Zope-2.4.0b1/lib/python/Products/ZPatterns/__init__.py, line 1, in ?
  File /home/jdavid/Zope-2.4.0b1/lib/python/Products/ZPatterns/Rack.py, line 1, in ?
  File /home/jdavid/Zope-2.4.0b1/lib/python/Products/ZPatterns/DataManagers.py, line 6, in ?
    (Object: ComputedAttribute)
  File /home/jdavid/Zope-2.4.0b1/lib/python/Products/ZPatterns/AttributeProviders.py, line 8, in ?
    (Object: ComputedAttribute)
  File /home/jdavid/Zope-2.4.0b1/lib/python/Products/ZPatterns/Expressions.py, line 38, in ?
    (Object: ComputedAttribute)
ImportError: cannot import name expr_globals


expr_globals is not available in Zope 2.4, the fix is:


38,39c38
< from DocumentTemplate.DT_Util import Eval, expr_globals, TemplateDict, \
<     InstanceDict
---
> from DocumentTemplate.DT_Util import Eval, TemplateDict, InstanceDict
41a41,47
> try:
>     # Zope 2.3.x
>     from DocumentTemplate.DT_Util import expr_globals
> except ImportError:
>     # Zope 2.4 (beta 1)
>     expr_globals=None
> 
103c109,114
<         self._v_expr = Eval(self.expr, expr_globals)
---
>         if expr_globals is None:
>             # Zope 2.4 (beta 1)
>             self._v_expr = Eval(self.expr)
>         else:
>             # Zope 2.3.x
>             self._v_expr = Eval(self.expr, expr_globals)


I've tested this only with Zope 2.4b1, but it should work with both, 2.4
and 2.3


Besides this error, there're some warnings:

/home/jdavid/Zope-2.4.0b1/lib/python/ts_regex.py:87: DeprecationWarning: the regex module is deprecated; please use the re module
  import regex, regsub #, Sync
/home/jdavid/Zope-2.4.0b1/lib/python2.1/regsub.py:15: DeprecationWarning: the regsub module is deprecated; please use re.sub()
  DeprecationWarning)
------
2001-06-26T08:51:13 PROBLEM(100) Init Ambiguous name for method of Products.PlugIns.PlugIns.PlugInGroup: "manage_workspace" != "manage_main"
WARNING: Python C API version mismatch for module DynPersist:
  This Python has API version 1010, module DynPersist has version 1007.


But I don't have a fix for them :(


Best regards,
jdavid