Decorator to enforce suspend

develop
RusAnon 2010-05-03 18:02:33 +11:00
parent 7ac5b9a1fe
commit e4210ad444
1 changed files with 15 additions and 0 deletions

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
"""
Decorators for bound classes
"""
from decorator import decorator
@decorator
def suspend(func, self, *args, **kw):
"""
This decorator will try to suspend DF and start needed module before running func
"""
if self.prepare():
return func(self, *args, **kw)
else:
raise Exception(u"Could not suspend/start")