<s> from collections import namedtuple <EOL> from corehq . apps . reminders . util import get_preferred_phone_number_for_recipient <EOL> from custom . ewsghana . handlers . helpers . stock_and_receipt_parser import EWSStockAndReceiptParser <EOL> from custom . ewsghana . handlers . soh import SOHHandler <EOL> from custom . ewsghana . utils import send_sms <EOL> VerifiedNumberAdapter = namedtuple ( '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> class WebSubmissionHandler ( SOHHandler ) : <EOL> async_response = True <EOL> def __init__ ( self , user , domain , msg , sql_location ) : <EOL> super ( WebSubmissionHandler , self ) . __init__ ( user , domain , [ ] , msg , None ) <EOL> self . _sql_location = sql_location <EOL> @ property <EOL> def sql_location ( self ) : <EOL> return self . _sql_location <EOL> @ property <EOL> def parser ( self ) : <EOL> return EWSStockAndReceiptParser ( <EOL> self . domain_object , <EOL> VerifiedNumberAdapter ( self . user , '<STR_LIT>' , self . domain , self . user . get_id ) , <EOL> self . sql_location . couch_location <EOL> ) <EOL> def respond ( self , message , ** kwargs ) : <EOL> phone_number = get_preferred_phone_number_for_recipient ( self . user ) <EOL> if not phone_number : <EOL> return <EOL> send_sms ( self . domain , self . user , phone_number , unicode ( message % kwargs ) ) </s>
