#NEWLINE# def requires_attr( attr_name , raiser ) : #NEWLINE# #INDENT# '\n    Methods wrapped in this decorator raise an error if a required\n    attribute is not set.\n    ' #NEWLINE# def decorator( meth ) : #NEWLINE# #INDENT# @ functools . wraps ( meth ) #NEWLINE# def wrapper( self , * args , **kwargs ) : #NEWLINE# #INDENT# if ( getattr ( self , attr_name , None ) is None ) : #NEWLINE# #INDENT# raiser ( self , meth , attr_name ) #NEWLINE# #UNINDENT# return meth ( self , * args , ** kwargs ) #NEWLINE# #UNINDENT# return wrapper #NEWLINE# #UNINDENT# return attr_name