Skip to content

Commit 5d1b1a5

Browse files
committed
Skip generating the pbw field if there is none.
1 parent d7776cc commit 5d1b1a5

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

appstore/locker.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def jsonify_locker_app(entry):
1616
release = app.releases[-1] if len(app.releases) > 0 else None # type: Release
1717
assets = app.asset_collections
1818

19-
return {
19+
return {**{
2020
'id': app.id,
2121
'uuid': app.app_uuid,
2222
'user_token': entry.user_token,
@@ -37,11 +37,6 @@ def jsonify_locker_app(entry):
3737
'name': app.developer.name,
3838
'contact_email': 'noreply@rebble.io',
3939
},
40-
'pbw': {
41-
'file': generate_pbw_url(release.id),
42-
'icon_resource_id': next(iter(release.binaries.values())).icon_resource_id,
43-
'release_id': release.id,
44-
},
4540
'hardware_platforms': [{
4641
'sdk_version': f"{x.sdk_major}.{x.sdk_minor}",
4742
'pebble_process_info_flags': x.process_info_flags,
@@ -73,7 +68,13 @@ def jsonify_locker_app(entry):
7368
'ios': jsonify_companion(app.companions.get('ios')),
7469
'android': jsonify_companion(app.companions.get('android')),
7570
},
76-
}
71+
}, **({
72+
'pbw': {
73+
'file': generate_pbw_url(release.id),
74+
'icon_resource_id': next(iter(release.binaries.values())).icon_resource_id,
75+
'release_id': release.id,
76+
}
77+
} if release and len(release.binaries) else {})}
7778

7879

7980
@api.route("/locker")

0 commit comments

Comments
 (0)