1 """cssutils helper
2 """
3 __all__ = ['Deprecated']
4 __docformat__ = 'restructuredtext'
5 __version__ = '$Id: errorhandler.py 1234 2008-05-22 20:26:12Z cthedot $'
6
8 """This is a decorator which can be used to mark functions
9 as deprecated. It will result in a warning being emitted
10 when the function is used.
11
12 It accepts a single paramter ``msg`` which is shown with the warning.
13 It should contain information which function or method to use instead.
14 """
17
19 def newFunc(*args, **kwargs):
20 import warnings
21 warnings.warn("Call to deprecated method %r. %s" %
22 (func.__name__, self.msg),
23 category=DeprecationWarning,
24 stacklevel=2)
25 return func(*args, **kwargs)
26 newFunc.__name__ = func.__name__
27 newFunc.__doc__ = func.__doc__
28 newFunc.__dict__.update(func.__dict__)
29 return newFunc
30