From d056bd0bd20460a661da1e3c1d2ee34d4c543300 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Mon, 21 Jan 2019 05:13:05 -0600 Subject: [PATCH] Fixed error when displaying certain user profile info. Closes #29 --- changelog.md | 1 + src/presenters/profiles.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 0382161..661504b 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ * Added experimental support to "subscribers" buffer, inside frienship requests. This shows friend requests that have been declined by the current user. * Fixed an error in Socializer that was making it unable to detect unread messages properly. * Socializer should save all tracebacks directly to error.log instead of displaying an error message during exit. ([#27,](https://code.manuelcortez.net/manuelcortez/socializer/issues/27)) +* When displaying user profiles, fixed an error where a married person without specifing relation partner would cause an error in the program. ([#29,](https://code.manuelcortez.net/manuelcortez/socializer/issues/29)) ## Changes in version 0.18 (21.01.2019) diff --git a/src/presenters/profiles.py b/src/presenters/profiles.py index 8c32d7d..5c4c1d9 100644 --- a/src/presenters/profiles.py +++ b/src/presenters/profiles.py @@ -113,7 +113,10 @@ class userProfilePresenter(base.basePresenter): elif person["relation"] == 3: r = _("Engaged with {0} {1}").format(person["relation_partner"]["first_name"], person["relation_partner"]["last_name"]) elif person["relation"] == 4: - r = _("Married with {0} {1}").format(person["relation_partner"]["first_name"], person["relation_partner"]["last_name"]) + if "relation_partner" in person: + r = _("Married to {0} {1}").format(person["relation_partner"]["first_name"], person["relation_partner"]["last_name"]) + else: + r = _("Married") elif person["relation"] == 5: r = _("It's complicated") elif person["relation"] == 6: