#NEWLINE# def make_secret( form_instance , secret_fields = None ) : #NEWLINE# #INDENT# '\n    Returns a secret for use in a EWP form or an IPN verification based on a\n    selection of variables in params. Should only be used with SSL.\n\n    ' #NEWLINE# if ( secret_fields is None ) : #NEWLINE# #INDENT# secret_fields = [ 'business' , 'item_name' ] #NEWLINE# #UNINDENT# data = '' #NEWLINE# for name in secret_fields : #NEWLINE# #INDENT# if hasattr ( form_instance , 'cleaned_data' ) : #NEWLINE# #INDENT# if ( name in form_instance . cleaned_data ) : #NEWLINE# #INDENT# data += unicode ( form_instance . cleaned_data [ name ] ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( name in form_instance . initial ) : #NEWLINE# #INDENT# data += unicode ( form_instance . initial [ name ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( name in form_instance . fields ) and ( form_instance . fields [ name ] . initial is not None ) ) : #NEWLINE# #INDENT# data += unicode ( form_instance . fields [ name ] . initial ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# secret = get_sha1_hexdigest ( settings . SECRET_KEY , data ) #NEWLINE# return secret