[Erp5-report] r41940 jm - in /erp5/trunk/products: CMFActivity/Activity/ ERP5/Document/ ERP...
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Jan 3 12:04:13 CET 2011
Author: jm
Date: Mon Jan 3 12:04:12 2011
New Revision: 41940
URL: http://svn.erp5.org?rev=41940&view=rev
Log:
Move some compatibility code for Python 2.4 into a single place
Added:
erp5/trunk/products/ERP5Type/patches/python.py
- copied, changed from r41910, erp5/trunk/products/ERP5Type/patches/re_patch.py
Removed:
erp5/trunk/products/ERP5Type/patches/re_patch.py
Modified:
erp5/trunk/products/CMFActivity/Activity/Queue.py
erp5/trunk/products/ERP5/Document/PDFTypeInformation.py
erp5/trunk/products/ERP5/mixin/cached_convertable.py
erp5/trunk/products/ERP5Form/ListBox.py
erp5/trunk/products/ERP5Form/Tool/SelectionTool.py
erp5/trunk/products/ERP5Type/Utils.py
erp5/trunk/products/ERP5Type/ZopePatch.py
erp5/trunk/products/ERP5Type/__init__.py
Modified: erp5/trunk/products/CMFActivity/Activity/Queue.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/Queue.py?rev=41940&r1=41939&r2=41940&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/Activity/Queue.py [utf8] (original)
+++ erp5/trunk/products/CMFActivity/Activity/Queue.py [utf8] Mon Jan 3 12:04:12 2011
@@ -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
Modified: erp5/trunk/products/ERP5/Document/PDFTypeInformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/PDFTypeInformation.py?rev=41940&r1=41939&r2=41940&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/PDFTypeInformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/PDFTypeInformation.py [utf8] Mon Jan 3 12:04:12 2011
@@ -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 DTMLDocumen
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
Modified: erp5/trunk/products/ERP5/mixin/cached_convertable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/cached_convertable.py?rev=41940&r1=41939&r2=41940&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] Mon Jan 3 12:04:12 2011
@@ -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
Modified: erp5/trunk/products/ERP5Form/ListBox.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/ListBox.py?rev=41940&r1=41939&r2=41940&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/ListBox.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/ListBox.py [utf8] Mon Jan 3 12:04:12 2011
@@ -50,11 +50,7 @@ from Products.ERP5Type.Globals import In
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'
Modified: erp5/trunk/products/ERP5Form/Tool/SelectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/Tool/SelectionTool.py?rev=41940&r1=41939&r2=41940&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/Tool/SelectionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/Tool/SelectionTool.py [utf8] Mon Jan 3 12:04:12 2011
@@ -41,10 +41,7 @@ from Products.ERP5Type.TransactionalVari
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
Modified: erp5/trunk/products/ERP5Type/Utils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Utils.py?rev=41940&r1=41939&r2=41940&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Utils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Utils.py [utf8] Mon Jan 3 12:04:12 2011
@@ -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
Modified: erp5/trunk/products/ERP5Type/ZopePatch.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ZopePatch.py?rev=41940&r1=41939&r2=41940&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ZopePatch.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/ZopePatch.py [utf8] Mon Jan 3 12:04:12 2011
@@ -67,7 +67,6 @@ from Products.ERP5Type.patches import ZO
# 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
Modified: erp5/trunk/products/ERP5Type/__init__.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/__init__.py?rev=41940&r1=41939&r2=41940&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/__init__.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/__init__.py [utf8] Mon Jan 3 12:04:12 2011
@@ -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
Copied: erp5/trunk/products/ERP5Type/patches/python.py (from r41910, erp5/trunk/products/ERP5Type/patches/re_patch.py)
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/python.py?p2=erp5/trunk/products/ERP5Type/patches/python.py&p1=erp5/trunk/products/ERP5Type/patches/re_patch.py&r1=41910&r2=41940&rev=41940&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/re_patch.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/python.py [utf8] Mon Jan 3 12:04:12 2011
@@ -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 re
-if not hasattr(re, '_compile'):
- import sre
+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, sre
re._compile = sre._compile
- del sre
-del re
Removed: erp5/trunk/products/ERP5Type/patches/re_patch.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/re_patch.py?rev=41939&view=auto
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/re_patch.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/re_patch.py (removed)
@@ -1,48 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsibility of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# guarantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-##############################################################################
-
-# 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
- re._compile = sre._compile
- del sre
-del re
More information about the Erp5-report
mailing list