From 655550ec6b683ce50a33d00cbc4340e5ecb49c44 Mon Sep 17 00:00:00 2001 From: Kload Date: Tue, 24 Sep 2013 20:04:13 +0000 Subject: [PATCH] Put apps in a list --- yunohost_app.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/yunohost_app.py b/yunohost_app.py index 690f5bb9..4e6cfa85 100644 --- a/yunohost_app.py +++ b/yunohost_app.py @@ -121,7 +121,10 @@ def app_list(offset=None, limit=None, filter=None, raw=False): applists = os.listdir(repo_path) app_dict = {} - list_dict = {} + if raw: + list_dict = {} + else: + list_dict=[] if not applists: app_fetchlist() @@ -144,22 +147,27 @@ def app_list(offset=None, limit=None, filter=None, raw=False): installed_txt = 'Yes ('+ str(instance_number) +' times)' elif instance_number == 1: installed_txt = 'Yes' + installed = True else: installed_txt = 'No' + installed = False if raw: + app_info['installed'] = installed list_dict[app_id] = app_info else: - list_dict[app_id] = [ - ('Name', app_info['manifest']['name']), - ('Version', app_info['manifest']['version']), - ('Description', app_info['manifest']['description']), - ('Installed', installed_txt) - ] + list_dict.append({ + 'ID': app_id, + 'Name': app_info['manifest']['name'], + 'Version': app_info['manifest']['version'], + 'Description': app_info['manifest']['description'], + 'Installed': installed_txt + }) i += 1 else: break - + if not raw: + list_dict = { 'Apps': list_dict } return list_dict