rpms/python/devel python-2.4.3-locale.patch, NONE, 1.1 python.spec, 1.85, 1.86

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Jul 21 12:41:57 UTC 2006


Author: misa

Update of /cvs/dist/rpms/python/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv11507

Modified Files:
	python.spec 
Added Files:
	python-2.4.3-locale.patch 
Log Message:
Fixed bug #198971 (case conversion not locale safe in logging library)

python-2.4.3-locale.patch:
 handlers.py |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

--- NEW FILE python-2.4.3-locale.patch ---
--- python/trunk/Lib/logging/handlers.py	2006/06/27 07:34:37	47121
+++ python/trunk/Lib/logging/handlers.py	2006/07/20 23:20:12	50740
@@ -562,6 +562,18 @@
         "local7":   LOG_LOCAL7,
         }
 
+    #The map below appears to be trivially lowercasing the key. However,
+    #there's more to it than meets the eye - in some locales, lowercasing
+    #gives unexpected results. See SF #1524081: in the Turkish locale,
+    #"INFO".lower() != "info"
+    priority_map = {
+        "DEBUG" : "debug",
+        "INFO" : "info",
+        "WARNING" : "warning",
+        "ERROR" : "error",
+        "CRITICAL" : "critical"
+    }
+
     def __init__(self, address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER):
         """
         Initialize a handler.
@@ -598,7 +610,7 @@
     #   necessary.
     log_format_string = '<%d>%s\000'
 
-    def encodePriority (self, facility, priority):
+    def encodePriority(self, facility, priority):
         """
         Encode the facility and priority. You can pass in strings or
         integers - if strings are passed, the facility_names and
@@ -619,6 +631,16 @@
             self.socket.close()
         logging.Handler.close(self)
 
+    def mapPriority(self, levelName):
+        """
+        Map a logging level name to a key in the priority_names map.
+        This is useful in two scenarios: when custom levels are being
+        used, and in the case where you can't do a straightforward
+        mapping by lowercasing the logging level name because of locale-
+        specific issues (see SF #1524081).
+        """
+        return self.priority_map.get(levelName, "warning")
+
     def emit(self, record):
         """
         Emit a record.
@@ -633,8 +655,8 @@
         """
         msg = self.log_format_string % (
             self.encodePriority(self.facility,
-                                string.lower(record.levelname)),
-            msg)
+                                self.mapPriority(record.levelname)),
+                                msg)
         try:
             if self.unixsocket:
                 try:


Index: python.spec
===================================================================
RCS file: /cvs/dist/rpms/python/devel/python.spec,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- python.spec	20 Jul 2006 17:02:51 -0000	1.85
+++ python.spec	21 Jul 2006 12:41:54 -0000	1.86
@@ -20,7 +20,7 @@
 Summary: An interpreted, interactive, object-oriented programming language.
 Name: %{python}
 Version: %{pybasever}.3
-Release: 13%{?dist}
+Release: 14%{?dist}
 License: PSF - see LICENSE
 Group: Development/Languages
 Provides: python-abi = %{pybasever}
@@ -44,6 +44,7 @@
 Patch16: python-2.4-gen-assert.patch
 Patch17: python-2.4-webbrowser.patch
 Patch18: python-2.4.3-cflags.patch
+Patch19: python-2.4.3-locale.patch
 
 %if %{main_python}
 Obsoletes: Distutils
@@ -152,6 +153,7 @@
 %patch16 -p2 -b .gen-assert
 %patch17 -p0 -b .web-browser
 %patch18 -p1 -b .cflags
+%patch19 -p2 -b .locale
 
 # This shouldn't be necesarry, but is right now (2.2a3)
 find -name "*~" |xargs rm -f
@@ -394,6 +396,9 @@
 %{_libdir}/python%{pybasever}/lib-dynload/_tkinter.so
 
 %changelog
+* Fri Jul 21 2006 Mihai Ibanescu <misa at redhat.com> - 2.4.3-14
+- Fixed bug #198971 (case conversion not locale safe in logging library)
+
 * Thu Jul 20 2006 Mihai Ibanescu <misa at redhat.com> - 2.4.3-13
 - Fixed bug #199373 (on some platforms CFLAGS is needed when linking)
 




More information about the fedora-cvs-commits mailing list