atomshields/reports/base.py
def report(func):
	"""
	Decorator for method run. This method will be execute before the execution
	from the method with this decorator.
	"""
	def execute(self, *args, **kwargs):
		try:
			print "[>] Executing {n} report. . . ".format(n=self.__class__.NAME)
			if hasattr(self, 'test'):
				if self.test():
					return func(self, *args, **kwargs)
				else:
					print colored("[!] The initial test for class {c} has not been successful".format(c=self.__class__.__name__), "red")
			else:
				return func(self, *args, **kwargs)

		except Exception as e:
			print colored("Error en la ejecución del report {n}: {e}".format(n=self.__class__.NAME, e = e), "red")

	return execute
def report(func):
	"""
	Decorator for method run. This method will be execute before the execution
	from the method with this decorator.
	"""
	def execute(self, *args, **kwargs):
		try:
			print "[>] Executing {n} report. . . ".format(n=self.__class__.NAME)
			if hasattr(self, 'test'):
				if self.test():
					return func(self, *args, **kwargs)
				else:
					print colored("[!] The initial test for class {c} has not been successful".format(c=self.__class__.__name__), "red")
			else:
				return func(self, *args, **kwargs)

		except Exception as e:
			print colored("Error en la ejecución del report {n}: {e}".format(n=self.__class__.NAME, e = e), "red")

	return execute
def report ( func ) : def execute ( self , * args , * * kwargs ) : try : print "[>] Executing {n} report. . . " . format ( n = self . __class__ . NAME ) if hasattr ( self , 'test' ) : if self . test ( ) : return func ( self , * args , * * kwargs ) else : print colored ( "[!] The initial test for class {c} has not been successful" . format ( c = self . __class__ . __name__ ) , "red" ) else : return func ( self , * args , * * kwargs ) except Exception as e : print colored ( "Error en la ejecución del report {n}: {e}". f ormat( n = s elf. _ _class__. N AME, ) , red") return execute
Decorator for method run. This method will be execute before the execution
	from the method with this decorator.
Decorator for method run . This method will be execute before the execution from the method with this decorator .