diff options
| author | Todd Willey <todd@ansolabs.com> | 2010-07-26 23:49:49 -0400 |
|---|---|---|
| committer | Todd Willey <todd@ansolabs.com> | 2010-07-26 23:49:49 -0400 |
| commit | 74ce3aef4dafca8b0fc6bf0404725afdefe335ec (patch) | |
| tree | 1678449c19d09a656812229ad2c5f1a8753482f6 /nova/compute | |
| parent | 7588ae06e8d6a7d526b12e0f15f3e5be522f16d0 (diff) | |
Give SessionToken an is_expired method
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/model.py | 5 |
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 |
