diff --git a/product/CMFActivity/Activity/Queue.py b/product/CMFActivity/Activity/Queue.py
index 32e5b23a5e59d88b6f7fdb4b984788f0347ea87a..ebe72c9aa6749c371c74fb07fbbcfcb6b0a01e76 100644
--- a/product/CMFActivity/Activity/Queue.py
+++ b/product/CMFActivity/Activity/Queue.py
@@ -27,13 +27,10 @@
 ##############################################################################
 
 import cPickle, sys
+from hashlib import sha1 as sha_new
 from DateTime import DateTime
 from zLOG import LOG, WARNING, ERROR
 from ZODB.POSException import ConflictError
-try:
-  from hashlib import sha1 as sha_new
-except ImportError:
-  from sha import new as sha_new
 from cStringIO import StringIO
 
 import transaction
diff --git a/product/ERP5/Document/PDFTypeInformation.py b/product/ERP5/Document/PDFTypeInformation.py
index 7f667369820c7ed3508026992c50aa87dd1aaf2e..73ac02deb992d9cdf5c37ed1e7df3957692071e1 100644
--- a/product/ERP5/Document/PDFTypeInformation.py
+++ b/product/ERP5/Document/PDFTypeInformation.py
@@ -28,6 +28,7 @@
 ##############################################################################
 
 import StringIO
+from hashlib import md5 as md5_new
 from AccessControl import ClassSecurityInfo
 from Products.ERP5Type.Cache import CachingMethod
 from Products.ERP5Type import Permissions, PropertySheet
@@ -40,11 +41,6 @@ from OFS.DTMLDocument import DTMLDocument
 from Products.ERP5Type.Utils import convertToUpperCase
 from Products.ERP5Type.Core.ActionInformation import CacheableAction
 
-try:
-  from hashlib import md5 as md5_new
-except ImportError:
-  from md5 import new as md5_new
-
 def getPropertiesCSSDict(parsed_scribus
                       , page_gap
                       , image_width
diff --git a/product/ERP5/mixin/cached_convertable.py b/product/ERP5/mixin/cached_convertable.py
index 20831e3a8edb536fdf7243d255796b32e66818ad..47f0e23b5b27823cdd261f4900d1bcf290608d64 100644
--- a/product/ERP5/mixin/cached_convertable.py
+++ b/product/ERP5/mixin/cached_convertable.py
@@ -27,10 +27,7 @@
 #
 ##############################################################################
 
-try:
-  from hashlib import md5 as md5_new
-except ImportError:
-  from md5 import new as md5_new
+from hashlib import md5 as md5_new
 import string
 
 from Acquisition import aq_base
diff --git a/product/ERP5Form/ListBox.py b/product/ERP5Form/ListBox.py
index bf745cb43749d0a1b7a5fc9787c3dacc8c0343a2..65a7f079ff11ce4065f5b923aa6c8475e5169e0a 100644
--- a/product/ERP5Form/ListBox.py
+++ b/product/ERP5Form/ListBox.py
@@ -50,11 +50,7 @@ from Products.ERP5Type.Globals import InitializeClass, get_request
 from Products.PythonScripts.Utility import allow_class
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 from warnings import warn
-
-try:
-  from hashlib import md5 as md5_new
-except ImportError:
-  from md5 import new as md5_new
+from hashlib import md5 as md5_new
 import cgi
 
 DEFAULT_LISTBOX_DISPLAY_STYLE = 'table'
diff --git a/product/ERP5Form/Tool/SelectionTool.py b/product/ERP5Form/Tool/SelectionTool.py
index 768755f16061bf502df348520e4e7cfc9b599f6d..0a4c37945014d7c7f0640af770085dc688f4c974 100644
--- a/product/ERP5Form/Tool/SelectionTool.py
+++ b/product/ERP5Form/Tool/SelectionTool.py
@@ -41,10 +41,7 @@ from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
 from Products.ERP5Form import _dtmldir
 from Products.ERP5Form.Selection import Selection, DomainSelection
 from ZPublisher.HTTPRequest import FileUpload
-try:
-  from hashlib import md5 as md5_new
-except ImportError:
-  from md5 import new as md5_new
+from hashlib import md5 as md5_new
 import string, re
 from time import time
 from random import random
diff --git a/product/ERP5Type/Utils.py b/product/ERP5Type/Utils.py
index 8330c09079b89cae5d9a279644d3abb5e40f6005..a65d3d1135e0f42ae7ac5577a24aad54371079a7 100644
--- a/product/ERP5Type/Utils.py
+++ b/product/ERP5Type/Utils.py
@@ -36,15 +36,7 @@ import warnings
 import sys
 import inspect
 import persistent
-try:
-  # Python 2.5 or later
-  from hashlib import md5 as md5_new
-  from hashlib import sha1 as sha_new
-except ImportError:
-  # Python 2.4
-  from md5 import new as md5_new
-  from sha import new as sha_new
-
+from hashlib import md5 as md5_new, sha1 as sha_new
 from Products.ERP5Type.Globals import package_home
 from Products.ERP5Type.Globals import DevelopmentMode
 from Acquisition import aq_base
diff --git a/product/ERP5Type/ZopePatch.py b/product/ERP5Type/ZopePatch.py
index 69e5e0428d107a19dfeacb12f414e7d386d49e99..7883c648456b8fa051a1cfdfa46a31232622d5c4 100644
--- a/product/ERP5Type/ZopePatch.py
+++ b/product/ERP5Type/ZopePatch.py
@@ -67,7 +67,6 @@ from Products.ERP5Type.patches import ZODBConnection
 # dropped support for older versions.
 from Products.ERP5Type.patches import TransactionAddBeforeCommitHook
 from Products.ERP5Type.patches import ZopePageTemplate
-from Products.ERP5Type.patches import re_patch
 
 # These symbols are required for backward compatibility
 from Products.ERP5Type.patches.PropertyManager import ERP5PropertyManager
diff --git a/product/ERP5Type/__init__.py b/product/ERP5Type/__init__.py
index 5f4dc1e71be710f15f039f3e4760b878cec5c52a..3f0cf07cb4078ed8181565dad592767fbb9e6e6f 100644
--- a/product/ERP5Type/__init__.py
+++ b/product/ERP5Type/__init__.py
@@ -30,6 +30,7 @@
     ERP5Type is provides a RAD environment for Zope / CMF
     All ERP5 classes derive from ERP5Type
 """
+from patches import python
 from zLOG import LOG, INFO
 DISPLAY_BOOT_PROCESS = False
 
diff --git a/product/ERP5Type/patches/re_patch.py b/product/ERP5Type/patches/python.py
similarity index 56%
rename from product/ERP5Type/patches/re_patch.py
rename to product/ERP5Type/patches/python.py
index bd9d2a4f00732bb983d2a741e80d35035f8f65a9..87ee1cedeae9abb50be5c963a26efd7f15c9febb 100644
--- a/product/ERP5Type/patches/re_patch.py
+++ b/product/ERP5Type/patches/python.py
@@ -26,23 +26,49 @@
 #
 ##############################################################################
 
-# A business template exported by Python 2.4 may contain:
-# <klass>
-#   <global id="xxx" name="_compile" module="sre"/>
-# </klass>
-#
-# A business template exported by Python 2.6 may contain:
-# <klass>
-#   <global id="xxx" name="_compile" module="re"/>
-# </klass>
-#
-# Python 2.6 provides 'sre._compile', but Python 2.4 does not provide
-# 're._compile', so we provide re._compile here for the backward
-# compatilibility.
+import sys
+
+if sys.version_info < (2, 5):
+  import __builtin__, imp
+
+  def all(iterable):
+    """
+    Return True if bool(x) is True for all values x in the iterable.
+    """
+    for x in iterable:
+      if not x:
+        return False
+    return True
+  __builtin__.all = all
+
+  def any(iterable):
+    """
+    Return True if bool(x) is True for any x in the iterable.
+    """
+    for x in iterable:
+      if x:
+        return True
+    return False
+  __builtin__.any = any
+
+  import md5, sha
+  sys.modules['hashlib'] = hashlib = imp.new_module('hashlib')
+  hashlib.md5 = md5.new
+  hashlib.sha1 = sha.new
+
+  # A business template exported by Python 2.4 may contain:
+  # <klass>
+  #   <global id="xxx" name="_compile" module="sre"/>
+  # </klass>
+  #
+  # A business template exported by Python 2.6 may contain:
+  # <klass>
+  #   <global id="xxx" name="_compile" module="re"/>
+  # </klass>
+  #
+  # Python 2.6 provides 'sre._compile', but Python 2.4 does not provide
+  # 're._compile', so we provide re._compile here for the backward
+  # compatilibility.
 
-import re
-if not hasattr(re, '_compile'):
-  import sre
+  import re, sre
   re._compile = sre._compile
-  del sre
-del re