#NEWLINE# def raw_post_view( request ) : #NEWLINE# #INDENT# 'A view which expects raw XML to be posted and returns content extracted\n    from the XML' #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# root = parseString ( request . body ) #NEWLINE# first_book = root . firstChild . firstChild #NEWLINE# ( title , author ) = [ n . firstChild . nodeValue for n in first_book . childNodes ] #NEWLINE# t = Template ( '{{ title }} - {{ author }}' , name = 'Book template' ) #NEWLINE# c = Context ( { #NEWLINE# #INDENT# 'title' : title , #NEWLINE# 'author' : request , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# t = Template ( 'GET request.' , name = 'Book GET template' ) #NEWLINE# c = Context ( ) #NEWLINE# #UNINDENT# return HttpResponse ( t . render ( c ) )