Changeset 531ce3a6fd488efc448d608ddc575d3ac5545710

Show
Ignore:
Timestamp:
02/13/09 14:09:59 (3 years ago)
Author:
Frederic Lepied <frederic.lepied@…>
Children:
bcaf3494df73e30262f508a84aa50fad8bc1d24a
Parents:
1641e797df31622a217ebb7904b766db82a1209d
git-committer:
Frederic Lepied <frederic.lepied@…> (02/13/09 14:09:59)
Message:

pass the logid to the upload url/function

Files:
3 modified

Legend:

Unmodified
Added
Removed
  • README

    rcb437b7 r531ce3a  
    7575 
    7676After the execution of a test script, the result is sent back to the 
    77 server using the following url: http://<ipaddr>:<port>/upload/. I 
     77server using the following url: http://<ipaddr>:<port>/upload/<test id>/. I 
    7878usualy run the following curl command to upload the result: 
    7979 
    80 curl --retry 0 -s -f -F "file=@$output" http://<ipaddr>:<port>/upload/ 
     80curl --retry 0 -s -f -F "file=@$output" http://<ipaddr>:<port>/upload/<test id>/ 
    8181 
    8282These uploaded files are stored under the directory set by the 
  • tester/views.py

    r5fc8fc0 r531ce3a  
    77from tester.models import * 
    88 
    9 def upload_file(request): 
    10     print 'upload_file' 
     9def upload_file(request, logid): 
     10    print 'upload_file', logid 
    1111    if request.method == 'POST': 
    1212        form = UploadFileForm(request.POST, request.FILES) 
    1313        mac = get_mac(request) 
    1414        s = get_object_or_404(System, macaddress__mac=simplify_mac(mac)) 
    15         logs = TestLog.objects.filter(system=s, status='S').order_by('date') 
    16         if len(logs) == 0: 
    17             raise Http404 
    18         log = logs[0] 
     15        log = get_object_or_404(TestLog, id=logid) 
    1916        if form.is_valid(): 
    2017            log.status = 'D' 
     
    9188        log.status = 'S' 
    9289        log.save() 
    93     print "%s (%s) -> %s" % (s.name, mac, name) 
    94     return render_to_response(name + settings.TEST_SUFFIX, {'testname': name, 'system': s.name}) 
     90    else: 
     91        log = None 
     92    print "%s (%s) -> %s (%s)" % (s.name, mac, name, str(log)) 
     93    return render_to_response(name + settings.TEST_SUFFIX, {'testname': name, 'system': s.name, 'log': log}) 
    9594 
    9695def logs(request, verid): 
     
    102101    log = get_object_or_404(TestLog, id=logid) 
    103102    infos = InfoLine.objects.filter(log=log).order_by('id') 
    104     return render_to_response('log.html', {'log': log, 'infos': infos})     
     103    return render_to_response('log.html', {'log': log, 'infos': infos}) 
    105104 
    106105def content(request, logid): 
  • urls.py

    r5fc8fc0 r531ce3a  
    1818    (r'^profile/$', 'pxe.views.profile1'), 
    1919                        
    20     (r'^upload/$', 'tester.views.upload_file'), 
     20    (r'^upload/(?P<logid>[0-9]+)/$', 'tester.views.upload_file'), 
    2121    (r'^nexttest/$', 'tester.views.next_test1'), 
    2222    (r'^nexttest/(?P<mac>[a-fA-F0-9:-]+)/$', 'tester.views.next_test'),