diff options
author | Sebastien Martini <seb@dbzteam.org> | 2009-10-19 12:56:21 +0200 |
---|---|---|
committer | Sebastien Martini <seb@dbzteam.org> | 2009-10-19 12:56:21 +0200 |
commit | 11d9e3aed421d2fbccf097daf6f291510f276856 (patch) | |
tree | 72c887d246acf19b8172b6a8042e469eb0bf19b2 | |
parent | fc50a600a6562812311d480ce6b0fe6fa67929ae (diff) | |
download | pyinotify-11d9e3aed421d2fbccf097daf6f291510f276856.tar.gz |
Fixed compatibility issue between Python 2.4 and UnicodeLogRecord
(reported by colin@ximenes.org.uk).
-rwxr-xr-x | pyinotify.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pyinotify.py b/pyinotify.py index 405828f..072ddc7 100755 --- a/pyinotify.py +++ b/pyinotify.py @@ -131,8 +131,14 @@ class PyinotifyLogger(logging.Logger): class UnicodeLogRecord(logging.LogRecord): def __init__(self, name, level, pathname, lineno, msg, args, exc_info, func=None): - logging.LogRecord.__init__(self, name, level, pathname, lineno, - msg, args, exc_info, func) + py_version = sys.version_info + # func argument was added in Python 2.5, just ignore it otherwise. + if py_version[0] >= 2 and py_version[1] >= 5: + logging.LogRecord.__init__(self, name, level, pathname, lineno, + msg, args, exc_info, func) + else: + logging.LogRecord.__init__(self, name, level, pathname, lineno, + msg, args, exc_info) def getMessage(self): msg = self.msg |