silence anoying warning on python 2.6

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30350 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a0b2c2b5
...@@ -175,11 +175,13 @@ def sortValueList(value_list, sort_on=None, sort_order=None, **kw): ...@@ -175,11 +175,13 @@ def sortValueList(value_list, sort_on=None, sort_order=None, **kw):
# Logging # Logging
##################################################### #####################################################
def _showwarning(message, category, filename, lineno, file=None): def _showwarning(message, category, filename, lineno, file=None, line=None):
if file is None: if file is None:
LOG("%s:%u %s: %s" % (filename, lineno, category.__name__, message), LOG("%s:%u %s: %s" % (filename, lineno, category.__name__, message),
WARNING, '') WARNING, '')
else: else:
# BACK: In Python 2.6 we need to pass along the "line" parameter to
# formatwarning(). For now we don't to keep backward compat with Python 2.4
file.write(warnings.formatwarning(message, category, filename, lineno)) file.write(warnings.formatwarning(message, category, filename, lineno))
warnings.showwarning = _showwarning warnings.showwarning = _showwarning
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment