Skip to content

Commit

Permalink
Added wrapper for deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
AltusBarry committed Sep 7, 2017
1 parent 9d20eb5 commit 921f40d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions formfactory/deprecation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import warnings

class generic_deprecation(object):
def __init__(self, message, warning_class=DeprecationWarning, stack_level=2):
self.message = message
self.warning_class = warning_class
self.stack_level = stack_level

def __call__(self, method):
def wrapped(*args, **kwargs):
warnings.warn(self.message, self.warning_class, self.stack_level)
return method(*args, **kwargs)
return wrapped

0 comments on commit 921f40d

Please sign in to comment.