<s> from sellmo . core import chaining <EOL> from sellmo . apps . customer . routines import customer_from_request <EOL> from sellmo . apps . customer . models import Contactable , Customer <EOL> from . routines import completed_order_from_request <EOL> @ chaining . link ( customer_from_request , takes_result = True ) <EOL> def _customer_from_request ( customer , request , ** kwargs ) : <EOL> order = completed_order_from_request ( request ) <EOL> if order is not None : <EOL> if customer is None : <EOL> customer = Contactable . clone ( order , cls = Customer ) <EOL> for address in order . addresses : <EOL> if address . address_type not in customer . addresses : <EOL> customer . addresses [ address . address_type ] = address . clone ( ) <EOL> yield customer <EOL> customer = ( yield chaining . wait ) [ '<STR_LIT>' ] <EOL> customer . last_completed_order = order </s>
