Saturday, January 29, 2011

Re: QUERYDICT immutable


On 2011-01-29, at 5:25 AM, sami nathan wrote:
now i want to change just message in my request.POST (denoted by red color in above request) and i am helpless  i tried the following code 

def recive_ShortMessage(request):
    if request.method == 'POST':
         request=request.POST.QueryDict.copy()
         qt=request.QueryDict.copy()
         print qt
         qt['message'] = 'I am changing it!'
         return HttpResponse(qt)

So presumably a) you'll want to parse the soap into some python datastructure then b) alter it and then c) serialise it back out as the new value. So you'll need to find a python SOAP library, suds might do it: https://fedorahosted.org/suds/

Please note that the HttpResponse takes a string, not a dictionary as you are trying to use. Documented here: http://docs.djangoproject.com/en/dev/ref/request-response/#httpresponse-objects
--
  Andy McKay
  andy@clearwind.ca
  twitter: @andymckay
 

No comments:

Post a Comment