[Python-Dev] logging module broken because of locale (original) (raw)

Mihai Ibanescu mihaiibanescu at yahoo.com
Thu Jul 20 15:49:05 CEST 2006


On Thu, Jul 20, 2006 at 05:09:38AM -0500, skip at pobox.com wrote:

Misa> Good point. Does the attached patch look reasonable? ... Misa> - self.when = string.upper(when) Misa> + self.when = unicode(when).upper() ... The use of the string module instead of string methods suggests to me that the logging package attempts to work with older versions of Python. Looking at PEP 291 it looks like 1.5.2 compatibility is desired (no string methods, no unicode). I think a conscious decision by someone (probably Vinay Sajip) to give up that compatibility would be required.

Agreed. There is a note that the module should work with python >= 1.5.2 at the top of the module.

It's up to Vinay to decide if we want to drop support for 1.5.2 in the module included in newer pythons, or the attached patch would make it work for 1.5.2 as well (as in "it's not more broken than before").

I would like to redo the patch once more to get rid of the try-except and use builtins instead (but for some reason it kept jumping from being a module to being a dictionary and I just wanted the proof of concept).

Misa -------------- next part -------------- --- Python-2.4.3/Lib/logging/handlers.py.nolocale 2006-07-19 12:15:46.000000000 -0400 +++ Python-2.4.3/Lib/logging/handlers.py 2006-07-20 09:45:57.000000000 -0400 @@ -162,7 +162,7 @@ """ def init(self, filename, when='h', interval=1, backupCount=0, encoding=None): BaseRotatingHandler.init(self, filename, 'a', encoding)

@@ -645,7 +645,7 @@ """ msg = self.log_format_string % ( self.encodePriority(self.facility,

@@ -854,7 +854,7 @@ ("GET" or "POST") """ logging.Handler.init(self)

@@ -1007,3 +1007,25 @@ self.flush() self.target = None BufferingHandler.close(self) + +def _upper(s):



More information about the Python-Dev mailing list