#NEWLINE# def send_item_json( ) : #NEWLINE# #INDENT# '\n    ' #NEWLINE# try : #NEWLINE# #INDENT# item_id = request . args [ 0 ] #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# raise HTTP ( 400 , current . xml . json_message ( False , 400 , 'No value provided!' ) ) #NEWLINE# #UNINDENT# stable = s3db . org_site #NEWLINE# istable = s3db . inv_send #NEWLINE# ittable = s3db . inv_track_item #NEWLINE# inv_ship_status = s3db . inv_ship_status #NEWLINE# istable . date . represent = ( lambda dt : dt [ : 10 ] ) #NEWLINE# query = ( ( ( ( ( ittable . req_item_id == item_id ) & ( istable . id == ittable . send_id ) ) & ( istable . site_id == stable . id ) ) & ( ( istable . status == inv_ship_status [ 'SENT' ] ) | ( istable . status == inv_ship_status [ 'RECEIVED' ] ) ) ) & ( ittable . deleted == False ) ) #NEWLINE# records = db ( query ) . select ( istable . id , istable . date , stable . name , ittable . quantity ) #NEWLINE# output = ( '[%s,%s' % ( json . dumps ( dict ( id = str ( T ( 'Sent' ) ) , quantity = '#' ) ) , records . json ( ) [ 1 : ] ) ) #NEWLINE# response . headers [ 'Content-Type' ] = 'application/json' #NEWLINE# return output