def get_feedback_form_context(request):
 context = {}
 context['subject'] = request.POST['subject']
 context['details'] = request.POST['details']
 context['tags'] = dict([(tag, request.POST[tag]) for tag in ['issue_type', 'course_id'] if request.POST.get(tag)])
 context['additional_info'] = {}
 if request.user.is_authenticated():
  context['realname'] = request.user.profile.name
  context['email'] = request.user.email
  context['additional_info']['username'] = request.user.username
 else:
  context['realname'] = request.POST['name']
  context['email'] = request.POST['email']
 for (header, pretty) in [('HTTP_REFERER', 'Page'), ('HTTP_USER_AGENT', 'Browser'), ('REMOTE_ADDR', 'Client IP'), ('SERVER_NAME', 'Host')]:
  context['additional_info'][pretty] = request.META.get(header)
 context['support_email'] = configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
 return context

def get_feedback_form_context ( request ) : context = { } context [ 'subject' ] = request . POST [ 'subject' ] context [ 'details' ] = request . POST [ 'details' ] context [ 'tags' ] = dict ( [ ( tag , request . POST [ tag ] ) for tag in [ 'issue_type' , 'course_id' ] if request . POST . get ( tag ) ] ) context [ 'additional_info' ] = { } if request . user . is_authenticated ( ) : context [ 'realname' ] = request . user . profile . name context [ 'email' ] = request . user . email context [ 'additional_info' ] [ 'username' ] = request . user . username else : context [ 'realname' ] = request . POST [ 'name' ] context [ 'email' ] = request . POST [ 'email' ] for ( header , pretty ) in [ ( 'HTTP_REFERER' , 'Page' ) , ( 'HTTP_USER_AGENT' , 'Browser' ) , ( 'REMOTE_ADDR' , 'Client IP' ) , ( 'SERVER_NAME' , 'Host' ) ] : context [ 'additional_info' ] [ pretty ] = request . META . get ( header ) context [ 'support_email' ] = configuration_helpers . get_value ( 'email_from_address' , settings . DEFAULT_FROM_EMAIL ) return context
extract the submitted form fields to be used as a context for feedback submission .