#NEWLINE# def update_address_book( self , user , shipping_addr ) : #NEWLINE# #INDENT# "\n        Update the user's address book based on the new shipping address\n        " #NEWLINE# try : #NEWLINE# #INDENT# user_addr = user . addresses . get ( hash = shipping_addr . generate_hash ( ) ) #NEWLINE# #UNINDENT# except ObjectDoesNotExist : #NEWLINE# #INDENT# user_addr = UserAddress ( user = user ) #NEWLINE# shipping_addr . populate_alternative_model ( user_addr ) #NEWLINE# #UNINDENT# user_addr . num_orders += 1 #NEWLINE# user_addr . save ( )