Discussion:
[Erp5-dev] ERP5 and python 2.3 ?
Jacek Medrzycki
2007-08-03 16:32:31 UTC
Permalink
Hi
I'm trying to run ERP5 with python 2.3. The CMFActivity product fails to
load with missed import 'locals' from threading module. I've checked
that it is new in python 2.4.
Question is, if current ERP5 releases can be run under python 2.3? I can
search for older CMFActivity, but won't it conflict with other ERP5
components?

Regards,
Jacek
Jérome Perrin
2007-08-03 16:48:01 UTC
Permalink
Post by Jacek Medrzycki
Hi
I'm trying to run ERP5 with python 2.3. The CMFActivity product fails to
load with missed import 'locals' from threading module. I've checked
that it is new in python 2.4.
from Products/ERP5Type/ZopePatch.py:

# for python2.3 compatibility
import threading
if not hasattr(threading, 'local'):
from Products.ERP5Type.patches.threading_local import local as
threading_local
threading.local = threading_local

This patch was for ERP5Type IIRC, but apparently CMFActivity is
initialized before this patch is applied.
Post by Jacek Medrzycki
Question is, if current ERP5 releases can be run under python 2.3?
I think we all use python 2.4, but it's better if we can support python 2.3

J?rome
Jacek Medrzycki
2007-08-06 14:15:41 UTC
Permalink
Post by Jérome Perrin
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

Loading...