summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorTodd Willey <todd@ansolabs.com>2010-07-26 23:49:49 -0400
committerTodd Willey <todd@ansolabs.com>2010-07-26 23:49:49 -0400
commit74ce3aef4dafca8b0fc6bf0404725afdefe335ec (patch)
tree1678449c19d09a656812229ad2c5f1a8753482f6 /nova/compute
parent7588ae06e8d6a7d526b12e0f15f3e5be522f16d0 (diff)
Give SessionToken an is_expired method
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/model.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/nova/compute/model.py b/nova/compute/model.py
index 7335d2c79..bae93b6c1 100644
--- a/nova/compute/model.py
+++ b/nova/compute/model.py
@@ -288,6 +288,11 @@ class SessionToken(datastore.BasicModel):
expires = time + diff
self['expiry'] = expires.strftime(utils.TIME_FORMAT)
+ def is_expired(self):
+ now = datetime.datetime.utcnow()
+ expires = utils.parse_isotime(self['expiry'])
+ return expires <= now
+
if __name__ == "__main__":
import doctest