I am having difficulty trying to test out the content of the main
window because it returns the status code
of 302. Here is the snippet of my view. So, when I first call the
search_form the request falls out of the
if request. GET. Does anyone have an idea on how I can test the
content of this page?

Thanks,
Jeff

def search_form(request):



    if request.GET:

        global_vars.search_data = request.GET.copy()
        form = SearchForm(global_vars.search_data)     # Instantiate
and load POST data

        if form.is_valid():                 # Validate data
             page_num = search(global_vars.search_data)

             if request.has_key('getrecs'):

                  rl = ResultList(request, page_num, 'Result')



                  c = template.RequestContext(request, {
                      'count': rl.result_count,
                      'rl': rl,
                  })
                  renderfile = resultsdir + '/results_list.html'
                  return render_to_response([renderfile],
context_instance=c)

             if request.has_key('getcsv'):
                  # Create the HttpResponse object with the
appropriate CSV header.
                  response = HttpResponse(mimetype='text/csv')
                  response['Content-Disposition'] = 'attachment;
filename=somefilename.csv'

                  qs = Result.objects.filter(**global_vars.query_dict)
                  qs = qs.exclude(**global_vars.exclude_query_dict)


                  writer = csv.writer(response)
                  writer.writerow(['row 1', 'ID', 'Test Name',
'Project', 'Phase', 'Test Type', 'Station',
                                  'Start Date', 'Owner', 'Status',
'Test Configuration'])
                  for i in range(len(qs)):
                      rowtext = 'row ' + str(i+2)
                      id = str(qs[i].id)
                      tname = qs[i].TestName
                      projname = str(qs[i].ProjectId)
                      phase = str(qs[i].PhaseId)
                      testtype = str(qs[i].TestTypeId)
                      station = str(qs[i].StationId)
                      startdate = str(qs[i].ExecutionStartDate)
                      owner = qs[i].Owner
                      status = str(qs[i].StatusId)
                      configdata =
ConfigResult.objects.filter(ResultsId='%s' %qs[i].id)
                      Configstr = ''
                      for configresult in configdata:
                          if Configstr != '':
                              Configstr += ','
                          Configstr += str(configresult)
                      writer.writerow([rowtext, id, tname, projname,
phase, testtype, station,
                                      startdate, owner, status,
Configstr])



                  return response
             if request.has_key('newresults'):
                  #redirectaddr = resultsdir + '/newresults/'
                  return HttpResponseRedirect('/resultsdb/newresults')

    else:

        form = SearchForm()


    # Create the FormWrapper, template, context, response.


    s = template.RequestContext(request, {
                 'form': form})

    renderfile = resultsdir + '/search_form.html'
    return render_to_response([renderfile], context_instance=s)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to