tags:

views:

47

answers:

1

I'm missing something obvious here. I am trying to process a POST request that contains a mixture of single value and multi value variables. I can get the single valued variables using request.POST.get('variable_name'), for example:

logging.debug('sale_date: ' + request.POST.get('SALEDATE'))

However, I can't get the multi value variables using request.POST.getlist('variable_name'). For example, the following returns an empty list.

prices = request.POST.getlist("IPN_PRICE")

I can't show all the fields in the request here, because it's work for a client. However this log call:

logging.debug(repr(request.POST)) 

gives this output (start only)

<QueryDict: {u'IPN_PRICE[]': [u'15.76'], ...

By the way, the request I'm trying to process is an IPN (Instant Payment Notification) from a payment processing service.

+3  A: 
prices = request.POST.getlist("IPN_PRICE[]")

This should do the trick.

dekomote
Certainly did. Many thanks!
swisstony