From a0ded66f852bda96f1cb5157247f840f1a724d01 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 28 Mar 2018 23:12:12 +0300 Subject: [PATCH] description format from config --- birthdays-cal.py | 7 +++++-- sample-config.yml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/birthdays-cal.py b/birthdays-cal.py index 33304d2..845ee4b 100644 --- a/birthdays-cal.py +++ b/birthdays-cal.py @@ -69,8 +69,11 @@ def make_event(person, year): lang_params = {'language': event_config['language']} - if 'birthday_no_year' not in person: - description += ', %d %s' % (age(person, year), zodiac_sign(person)) + if 'birthday_no_year' in person: + description = description.replace('{age}', '') + + description = description.format( + age=age(person, year), zodiac=zodiac_sign(person)) event = Event() event.add('uid', sha1(person['name'] + ' birthday ' + str(year))) diff --git a/sample-config.yml b/sample-config.yml index e5d7f86..f57e8a0 100644 --- a/sample-config.yml +++ b/sample-config.yml @@ -3,7 +3,7 @@ calname: My friends birthdays! timezone: UTC events: - description: Happy birthday + description: Happy birthday, {age} {zodiac} categories: birthday scale: