summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Reports/reports/models.py
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2008-08-29 00:36:32 +0000
committerSol Jerome <solj@ices.utexas.edu>2008-08-29 00:36:32 +0000
commit703fd1a0584288aa10f6661cd22fcf5123ecf6bd (patch)
tree882c1e2f7fbf291467f409b8f75d66a34c2935e3 /src/lib/Server/Reports/reports/models.py
parent4d23a9ea84291522dcd18dd996ae4ba03eeb6a84 (diff)
downloadbcfg2-703fd1a0584288aa10f6661cd22fcf5123ecf6bd.tar.gz
bcfg2-703fd1a0584288aa10f6661cd22fcf5123ecf6bd.tar.bz2
bcfg2-703fd1a0584288aa10f6661cd22fcf5123ecf6bd.zip
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
Diffstat (limited to 'src/lib/Server/Reports/reports/models.py')
-rw-r--r--src/lib/Server/Reports/reports/models.py13
1 files changed, 8 insertions, 5 deletions
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: