From 4276dbe347ad594a244e1d8dd5f1b313dd1b9e7d Mon Sep 17 00:00:00 2001 From: "Adam D. Barratt" Date: Sun, 4 Sep 2011 18:58:14 +0000 Subject: [PATCH] hints: support package and version properties. Each property returns the value of the corresponding property for the first entry in the package list; this is a handy short-cut for hints where there will only ever be one package in the list (e.g. "age-days", "unblock"). Signed-off-by: Adam D. Barratt --- hints.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hints.py b/hints.py index de03786..0ce0993 100644 --- a/hints.py +++ b/hints.py @@ -84,3 +84,18 @@ class Hint: @property def days(self): return self._days + + @property + def package(self): + if self.packages: + return self.packages[0].package + else: + return None + + @property + def version(self): + if self.packages: + return self.packages[0].version + else: + return None +