[cvs] / lkrtweb / lkrt / models.py  

cvs: lkrtweb/lkrt/models.py

Diff for /lkrtweb/lkrt/models.py between version 1.3 and 1.4

version 1.3, Sun Apr 8 01:05:43 2007 UTC version 1.4, Sat Apr 28 16:39:28 2007 UTC
Line 1 
Line 1 
 from django.db import models  from django.db import models
 from django.contrib.auth.models import User  from django.contrib.auth.models import User
   from lkrtweb.lkrt.helpers import db
   from django.core.exceptions import ObjectDoesNotExist
   
 import os  import os
   
Line 118 
Line 120 
                 super(KernelVersion, self).save()                  super(KernelVersion, self).save()
   
         def status_for_arch(self, arch):          def status_for_arch(self, arch):
                 tests = FunctionalTest.objects.filter(kversion__id=self.id, client__arch__id=arch.id)                  objs = db.query('''SELECT max(status_id) as status_id
                                           FROM $FunctionalTest$, $ClientMachine$
                                           WHERE $FunctionalTest$.client_id = $ClientMachine$.id
                                                   AND $ClientMachine$.arch_id=%s
                                                   AND $FunctionalTest$.kversion_id=%s''' % (arch.id, self.id))
   
                   stat = None
   
                   if objs[0][0] != None:
                           try:
                                   stat = Status.objects.get(id=objs[0][0])
                           except ObjectDoesNotExist:
                                   pass
   
                 if tests.count() > 0:                  return stat
                         val = 0  
                         for test in tests:  
                                 val = max(val, test.status_id)  
                         result = Status.objects.get(id=val)  
                 else:  
                         result = None  
   
                 return result          #       tests = FunctionalTest.objects.filter(kversion__id=self.id, client__arch__id=arch.id)
           #
           #       if tests.count() > 0:
           #               val = 0
           #               for test in tests:
           #                       val = max(val, test.status_id)
           #               result = Status.objects.get(id=val)
           #       else:
           #               result = None
           #
           #       return result
   
         def add_patch_at_url(self, url):          def add_patch_at_url(self, url):
                 patch, created = File.objects.get_or_create(url=url)                  patch, created = File.objects.get_or_create(url=url)


Generate output suitable for use with a patch program
Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

Tobias McNulty

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help