From 703fd1a0584288aa10f6661cd22fcf5123ecf6bd Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Fri, 29 Aug 2008 00:36:32 +0000 Subject: Fix bcfg2-reports to use new reporting system schema. git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4897 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Reports/reports/models.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/lib/Server/Reports/reports/models.py') diff --git a/src/lib/Server/Reports/reports/models.py b/src/lib/Server/Reports/reports/models.py index 333618a56..a45fb0d30 100644 --- a/src/lib/Server/Reports/reports/models.py +++ b/src/lib/Server/Reports/reports/models.py @@ -29,12 +29,12 @@ TYPE_CHOICES = ( ) class ClientManager(models.Manager): '''extended client manager functions''' - def active(self,timestamp='now'): + def active(self, timestamp='now'): '''returns a set of clients that have been created and have not yet been expired as of optional timestmamp argument. Timestamp should be a string formatted in the fashion: 2006-01-01 00:00:00''' - if timestamp=='now': + if timestamp == 'now': timestamp = datetime.now() else: print timestamp @@ -42,8 +42,11 @@ class ClientManager(models.Manager): timestamp = datetime(*strptime(timestamp, "%Y-%m-%d %H:%M:%S")[0:6]) except ValueError: return self.filter(expiration__lt=timestamp, creation__gt=timestamp); - #this is a really hacky way to return an empty QuerySet - #this should return Client.objects.none() in Django development version. + ''' + - this is a really hacky way to return an empty QuerySet + - this should return Client.objects.none() in Django + development version. + ''' return self.filter(Q(expiration__gt=timestamp) | Q(expiration__isnull=True), creation__lt=timestamp) @@ -130,7 +133,7 @@ class Interaction(models.Model): return 0 def isclean(self): - if (self.bad_items.count() == 0 and self.goodcount == self.totalcount): + if (self.bad().count() == 0 and self.goodcount == self.totalcount): #if (self.state == "good"): return True else: -- cgit v1.2.3-1-g7c22