def related_bug(bug, status_code=None):
 def decorator(f):
  @functools.wraps(f)
  def wrapper(self, *func_args, **func_kwargs):
   try:
    return f(self, *func_args, **func_kwargs)
   except Exception as exc:
    exc_status_code = getattr(exc, 'status_code', None)
    if ((status_code is None) or (status_code == exc_status_code)):
     LOG.error('Hints: This test was made for the bug %s. The failure could be related to https://launchpad.net/bugs/%s', bug, bug)
    raise exc
  return wrapper
 return decorator

def related_bug ( bug , status_code = None ) : def decorator ( f ) : @ functools . wraps ( f ) def wrapper ( self , * func_args , ** func_kwargs ) : try : return f ( self , * func_args , ** func_kwargs ) except Exception as exc : exc_status_code = getattr ( exc , 'status_code' , None ) if ( ( status_code is None ) or ( status_code == exc_status_code ) ) : LOG . error ( 'Hints: This test was made for the bug %s. The failure could be related to https://launchpad.net/bugs/%s' , bug , bug ) raise exc return wrapper return decorator
a decorator useful to know solutions from launchpad bug reports .