''' These decorators should only by used for the majordome class (majordome/tasks.py) ''' def acceptedStatus(status): def deco(func): def tag_decorator(self, *args, **kwargs): for i in status: if self.current_status == i: return func(self, *args, **kwargs) return -1 return tag_decorator return deco def executingSequenceExist(func): def class_method(self, *args, **kwargs): if self.executing_sequence is None: return -1 return func(self, *args, **kwargs) return class_method def executable(func): def class_method(self, *args, **kwargs): ret = self.isExecutable() if ret: return ret return func(self, *args, **kwargs) return class_method def weatherCheck(func): def class_method(self, *args, **kwargs): ret = self.isOutsideOk() if ret: return ret return func(self, *args, **kwargs) return class_method def SameAlarmCheck(func): def class_method(self, type, *args, **kwargs): if type in self.alarm_list: return -1 return func(self, type, *args, **kwargs) return class_method def devicesCheck(func): def class_method(self, *args, **kwargs): ret = self.isDevicesOk() if ret: return ret return func(self, *args, **kwargs) return class_method def insideCheck(func): def class_method(self, *args, **kwargs): ret = self.isInsideOk() if ret: return ret return func(self, *args, **kwargs) return class_method