[Erp5-dev] ERP5 and python 2.3 ?

Jacek Medrzycki jacek at erp5.pl
Mon Aug 6 16:15:41 CEST 2007


Jérome Perrin pisze:
>
>
> This patch was for ERP5Type IIRC, but apparently CMFActivity is 
> initialized before this patch is applied.

Yes. CMFActivity imports initializeProduct and updateGlobalsProducts 
from ERP5Type.Utils.py, which in turn, after some succesive imports, 
tries to import TransactionalVariable.py, in which 'local' is beeing 
imported. All is done before __init__.py of ERP5Type is called, in which 
ZopePatch.py is imported, so it fails with 2.3.

So I put following there and it seems to fix the problem (at least Zope 
starts, I haven't run unit tests yet)

===================================================================
--- TransactionalVariable.py    (revision 14597)
+++ TransactionalVariable.py    (working copy)
@@ -57,6 +57,10 @@

 from UserDict import IterableUserDict
 from Shared.DC.ZRDB.TM import TM
+import threading
+if not hasattr(threading, 'local'):
+  from Products.ERP5Type.patches.threading_local import local as 
threading_local
+  threading.local = threading_local
 from threading import local

 class TransactionalVariable(TM, IterableUserDict):



However I wonder if there is a better place to put this patch (or should 
we just call ZopePatch.py in CMFActivity's __init__.py?)


Regards
Jacek



More information about the Erp5-dev mailing list