[Dextrose] [PATCH 2/2] Fix all xo models path version
Martin Abente
martin.abente.lahaye at gmail.com
Mon Feb 14 15:48:00 EST 2011
Expiration date feature was using a harcoded
lease.sig path, which was only available for
the XO 1.0.
This add a new method to determine which path
should be used.
Signed-off-by: Martin Abente <martin.abente.lahaye at gmail.com>
---
extensions/cpsection/aboutcomputer/model.py | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/extensions/cpsection/aboutcomputer/model.py b/extensions/cpsection/aboutcomputer/model.py
index 5bbd4af..59e370a 100644
--- a/extensions/cpsection/aboutcomputer/model.py
+++ b/extensions/cpsection/aboutcomputer/model.py
@@ -25,6 +25,9 @@ from datetime import datetime
from jarabe import config
+_XO_1_0_LEASE_PATH = '/security/lease.sig'
+_XO_1_5_LEASE_PATH = '/bootpart/boot/security/lease.sig'
+
_logger = logging.getLogger('ControlPanel - AboutComputer')
_not_available = _('Not available')
@@ -36,8 +39,16 @@ def get_aboutcomputer():
def print_aboutcomputer():
print get_aboutcomputer()
+def _get_lease_path():
+ if os.path.exists(_XO_1_0_LEASE_PATH):
+ return _XO_1_0_LEASE_PATH
+ elif os.path.exists(_XO_1_5_LEASE_PATH):
+ return _XO_1_5_LEASE_PATH
+ else:
+ return ''
+
def get_lease_days():
- lease_file = _read_file('/security/lease.sig')
+ lease_file = _read_file(_get_lease_path())
if lease_file == None:
return 'Information not available!'
--
1.7.1
More information about the Dextrose
mailing list