[sysadmin-bin] We need a list of dicts because Wordpress™
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] We need a list of dicts because Wordpress™
- Date: Fri, 12 Mar 2021 11:52:24 +0000 (UTC)
commit ccc5a3746243f36276b3592e04e7dcd42cfb8bd9
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date: Fri Mar 12 12:52:04 2021 +0100
We need a list of dicts because Wordpress™
membership/foundation-operations.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/membership/foundation-operations.py b/membership/foundation-operations.py
index c5d4642..1881d5f 100755
--- a/membership/foundation-operations.py
+++ b/membership/foundation-operations.py
@@ -112,21 +112,26 @@ def generate_membership_list():
foundationmembers = glu.get_uids_from_group("foundation")
emeritus = glu.get_uids_from_group("emeritus")
- result = {"members": [], "emeritus": []}
+ members_list = []
+ emeritus_list = []
+ result = {}
for member in foundationmembers:
ldap_fields = glu.get_attributes_from_ldap(member, "cn", "LastRenewedOn")
common_name_attr = ldap_fields[1].decode("utf-8")
- result["members"].append(common_name_attr)
- result["members"].sort(key=str.casefold)
+ members_list.append(common_name_attr)
+ members_list.sort(key=str.casefold)
for member in emeritus:
ldap_fields = glu.get_attributes_from_ldap(member, "cn", "LastRenewedOn")
common_name_attr = ldap_fields[1].decode("utf-8")
- result["emeritus"].append(common_name_attr)
- result["emeritus"].sort(key=str.casefold)
+ emeritus_list.append(common_name_attr)
+ emeritus_list.sort(key=str.casefold)
+
+ result['members'] = [{"name": name} for name in members_list]
+ result['emeritus'] = [{"name": name} for name in emeritus_list]
with open("memberslist.json", "w") as f:
json.dump(result, f)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]