1.1 --- a/imiptools/data.py Sat Oct 07 00:39:09 2017 +0200
1.2 +++ b/imiptools/data.py Sat Oct 07 01:11:21 2017 +0200
1.3 @@ -166,6 +166,9 @@
1.4 def get_value(self, name):
1.5 return get_value(self.details, name)
1.6
1.7 + def set_value(self, name, value, attr=None):
1.8 + self.details[name] = [(value, attr or {})]
1.9 +
1.10 def get_utc_datetime(self, name, date_tzid=None):
1.11 return get_utc_datetime(self.details, name, date_tzid)
1.12
1.13 @@ -764,11 +767,22 @@
1.14 finally:
1.15 out.close()
1.16
1.17 -def new_object(object_type):
1.18 +def new_object(object_type, organiser=None, organiser_attr=None):
1.19 +
1.20 + """
1.21 + Make a new object of the given 'object_type' and optional 'organiser',
1.22 + with optional 'organiser_attr' describing any organiser identity in more
1.23 + detail.
1.24 + """
1.25
1.26 - "Make a new object of the given 'object_type'."
1.27 + details = {}
1.28
1.29 - return Object({object_type : ({}, {})})
1.30 + if organiser:
1.31 + details["UID"] = [(make_uid(organiser), {})]
1.32 + details["ORGANIZER"] = [(organiser, organiser_attr or {})]
1.33 + details["DTSTAMP"] = [(get_timestamp(), {})]
1.34 +
1.35 + return Object({object_type : (details, {})})
1.36
1.37 def make_uid(user):
1.38
2.1 --- a/tools/invite.py Sat Oct 07 00:39:09 2017 +0200
2.2 +++ b/tools/invite.py Sat Oct 07 01:11:21 2017 +0200
2.3 @@ -3,7 +3,7 @@
2.4 """
2.5 Prepare an invitation message.
2.6
2.7 -Copyright (C) 2016 Paul Boddie <paul@boddie.org.uk>
2.8 +Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk>
2.9
2.10 This program is free software; you can redistribute it and/or modify it under
2.11 the terms of the GNU General Public License as published by the Free Software
2.12 @@ -22,7 +22,7 @@
2.13 from datetime import datetime
2.14 from imiptools.data import get_address, make_uid, new_object
2.15 from imiptools.dates import get_datetime, get_datetime_item, \
2.16 - get_default_timezone \
2.17 + get_default_timezone
2.18 from imiptools.period import Period
2.19 from imiptools.mail import Messenger
2.20 from os.path import split
2.21 @@ -48,9 +48,7 @@
2.22
2.23 # Create an event for the calendar with the organiser and attendee details.
2.24
2.25 - e = new_object("VEVENT")
2.26 - e["UID"] = [(make_uid(organiser), {})]
2.27 - e["ORGANIZER"] = [(organiser, {})]
2.28 + e = new_object("VEVENT", organiser)
2.29
2.30 attendees = []
2.31