[Erp5-report] r43809 jerome - /erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Feb 28 14:03:07 CET 2011


Author: jerome
Date: Mon Feb 28 14:03:07 2011
New Revision: 43809

URL: http://svn.erp5.org?rev=43809&view=rev
Log:
Expose the original __init__ method of cache entry.
I know some tests where we test scripts that are caching some classes defined in the script itself. It works fine, but this patch reports them as an error.
This gives an opportunity to unapply this monkey patch in the rare case it's needed.

Modified:
    erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py

Modified: erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py?rev=43809&r1=43808&r2=43809&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] Mon Feb 28 14:03:07 2011
@@ -1315,12 +1315,13 @@ def fortify():
   '''
   # check that we don't store persistent objects in cache
   from Products.ERP5Type.CachePlugins.BaseCache import CacheEntry
-  CacheEntry__init__ = CacheEntry.__init__
+  CacheEntry.__original_init__ = CacheEntry.__init__
   def __init__(self, value, *args, **kw):
     # this will raise TypeError if you try to cache a persistent object
     dumps(value)
-    CacheEntry__init__(self, value, *args, **kw)
+    return self.__original_init__(value, *args, **kw)
   CacheEntry.__init__ = __init__
+
   # randomize priorities of activities in a deterministic way
   seed = os.environ.get("random_activity_priority")
   if seed is not None:



More information about the Erp5-report mailing list