<s> import urlparse <EOL> from django . http import HttpRequest <EOL> from django . shortcuts import render_to_response <EOL> from pyws . adapters . _django import serve <EOL> from server import server <EOL> PROTOCOLS = ( <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ) <EOL> def test_form ( request ) : <EOL> data = { <EOL> '<STR_LIT>' : PROTOCOLS , <EOL> } <EOL> if request . method == '<STR_LIT:POST>' : <EOL> tail = request . POST [ '<STR_LIT>' ] <EOL> protocol = request . POST [ '<STR_LIT>' ] <EOL> query_string = request . POST [ '<STR_LIT>' ] <EOL> request_text = request . POST [ '<STR_LIT>' ] <EOL> fake_request = HttpRequest ( ) <EOL> fake_request . GET = urlparse . parse_qs ( query_string ) <EOL> if not query_string : <EOL> fake_request . _raw_post_data = request_text <EOL> response = serve ( fake_request , protocol + '<STR_LIT:/>' + tail , server ) <EOL> data . update ( { <EOL> '<STR_LIT>' : tail , <EOL> '<STR_LIT>' : protocol , <EOL> '<STR_LIT>' : query_string , <EOL> '<STR_LIT>' : request_text , <EOL> '<STR_LIT>' : response , <EOL> } ) <EOL> return render_to_response ( '<STR_LIT>' , data ) </s>
