1.1 --- a/imipweb/resource.py Mon Sep 28 23:12:58 2015 +0200
1.2 +++ b/imipweb/resource.py Mon Sep 28 23:22:54 2015 +0200
1.3 @@ -548,11 +548,12 @@
1.4 def get_date_control_values(self, name, multiple=False, tzid_name=None):
1.5
1.6 """
1.7 - Return a dictionary containing date, time and tzid entries for fields
1.8 - starting with 'name'. If 'multiple' is set to a true value, many
1.9 - dictionaries will be returned corresponding to a collection of
1.10 - datetimes. If 'tzid_name' is specified, the time zone information will
1.11 - be acquired from a field starting with 'tzid_name' instead of 'name'.
1.12 + Return a form date object representing fields starting with 'name'. If
1.13 + 'multiple' is set to a true value, many date objects will be returned
1.14 + corresponding to a collection of datetimes.
1.15 +
1.16 + If 'tzid_name' is specified, the time zone information will be acquired
1.17 + from fields starting with 'tzid_name' instead of 'name'.
1.18 """
1.19
1.20 args = self.env.get_args()
1.21 @@ -583,4 +584,22 @@
1.22
1.23 return all_values
1.24
1.25 + def set_date_control_values(self, name, formdates, tzid_name=None):
1.26 +
1.27 + """
1.28 + Replace form fields starting with 'name' using the values of the given
1.29 + 'formdates'.
1.30 +
1.31 + If 'tzid_name' is specified, the time zone information will be stored in
1.32 + fields starting with 'tzid_name' instead of 'name'.
1.33 + """
1.34 +
1.35 + args = self.env.get_args()
1.36 +
1.37 + args["%s-date" % name] = [d.date for d in formdates]
1.38 + args["%s-hour" % name] = [d.hour for d in formdates]
1.39 + args["%s-minute" % name] = [d.minute for d in formdates]
1.40 + args["%s-second" % name] = [d.second for d in formdates]
1.41 + args["%s-tzid" % (tzid_name or name)] = [d.tzid for d in formdates]
1.42 +
1.43 # vim: tabstop=4 expandtab shiftwidth=4