summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Martini <seb@dbzteam.org>2009-10-19 12:56:21 +0200
committerSebastien Martini <seb@dbzteam.org>2009-10-19 12:56:21 +0200
commit11d9e3aed421d2fbccf097daf6f291510f276856 (patch)
tree72c887d246acf19b8172b6a8042e469eb0bf19b2
parentfc50a600a6562812311d480ce6b0fe6fa67929ae (diff)
downloadpyinotify-11d9e3aed421d2fbccf097daf6f291510f276856.tar.gz
Fixed compatibility issue between Python 2.4 and UnicodeLogRecord
(reported by colin@ximenes.org.uk).
-rwxr-xr-xpyinotify.py10
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