[Dextrose] [PATCH 2/2] Fix all xo models path version

Anish Mangal anish at sugarlabs.org
Mon Feb 14 21:48:20 EST 2011


On Mon, Feb 14, 2011 at 17:48, Martin Abente
<martin.abente.lahaye at gmail.com> wrote:
> 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
>

Committed to dx/mainline:
http://git.sugarlabs.org/dextrose/mainline/commit/a432a7cbf19d256c749547fd07bba0ef4e15227c

Reviewed-by: Anish Mangal <anish at activitycentral.org>
Acked-by: Anish Mangal <anish at activitycentral.org>


More information about the Dextrose mailing list