From abe422fd7a7cf39d4463e5e1271f36cae1af8a17 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 6 Jul 2017 11:24:55 +0200 Subject: [PATCH] handle App instance with no Builds when writing YAML --- fdroidserver/metadata.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index d832fd0c..c794a541 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -1051,9 +1051,11 @@ def write_yaml(mf, app): # next iteration will need to insert a newline insert_newline = True else: - if (hasattr(app, field) and getattr(app, field)) or field is 'Builds': + if app.get(field) or field is 'Builds': + # .txt calls it 'builds' internally, everywhere else its 'Builds' if field is 'Builds': - cm.update({field: _builds_to_yaml(app)}) + if app.get('builds'): + cm.update({field: _builds_to_yaml(app)}) elif field is 'CurrentVersionCode': cm.update({field: _field_to_yaml(TYPE_INT, getattr(app, field))}) else: -- 2.30.2