From 7aa5b2a03cafc0571d81ee84758d1b148ef61995 Mon Sep 17 00:00:00 2001 From: Edoardo Putti Date: Sat, 29 Oct 2016 09:43:03 +0200 Subject: [PATCH] set truthy values for Requests and Certificates --- certificate.py | 3 +++ request.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/certificate.py b/certificate.py index b03b206..4493993 100755 --- a/certificate.py +++ b/certificate.py @@ -17,6 +17,9 @@ class Certificate(object): def __repr__(self): return ( "%s %s" % ( str(self.__class__.__name__), str(self.cert_id) ) ) + def __bool__(self): + return os.path.exists(self.path) + @property def path(self): return os.path.join(OUTPUT_PATH, self.cert_id + '-cert.pub') diff --git a/request.py b/request.py index 6dcdc63..8004021 100755 --- a/request.py +++ b/request.py @@ -20,6 +20,9 @@ class SignRequest(object): def __repr__(self): return ( "%s %s" % ( str(self.__class__.__name__), str(self.req_id) ) ) + def __bool__(self): + return os.path.exists(self.path) + @property def name(self): raise NotImplementedError()