From 7ce5142bb566948dac8237b845bc07cc683898c1 Mon Sep 17 00:00:00 2001 From: barate Date: Wed, 9 Nov 2011 15:11:15 +0000 Subject: [PATCH] Fix bug with Python 2.7 and update doc in module deprecation --- src/KERNEL_PY/kernel/deprecation.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/KERNEL_PY/kernel/deprecation.py b/src/KERNEL_PY/kernel/deprecation.py index 9d53be0e2..c571d0812 100644 --- a/src/KERNEL_PY/kernel/deprecation.py +++ b/src/KERNEL_PY/kernel/deprecation.py @@ -21,6 +21,16 @@ """ This module provides several functions to indicate the deprecation of a module, a method or a function. + +Example:: + + from salome.kernel.deprecation import deprecated + + @deprecated("Deprecated since version 6.3.0. Consider replacement with " + "newFunction()") + def oldFunction(): + ... + """ import sys @@ -112,4 +122,8 @@ def __show_colored_warning(message, category, filename, else: file.write(str) +# Enable warnings for deprecated functions and modules (in Python 2.7, they +# are disabled by default) +warnings.filterwarnings("always", "Call to *", DeprecationWarning) +warnings.filterwarnings("always", "Importation of *", DeprecationWarning) warnings.showwarning = __show_colored_warning -- 2.39.2