[FIX] calendar: Fix unicode reminders
Before this commit, if a reminder was created and the dates being formatted contained unicode characters the whole thing would break because python + unicode is hard. Example: Japanese with Asia/Tokyo timezone and creating reminders of 1 day, see support ticket 771674
This commit is contained in:
@@ -645,16 +645,30 @@ class Meeting(models.Model):
|
||||
date_deadline = fields.Datetime.context_timestamp(self.with_context(tz=timezone), fields.Datetime.from_string(stop))
|
||||
|
||||
# convert into string the date and time, using user formats
|
||||
date_str = date.strftime(format_date)
|
||||
time_str = date.strftime(format_time)
|
||||
date_str = date.strftime(format_date).decode('utf-8')
|
||||
time_str = date.strftime(format_time).decode('utf-8')
|
||||
|
||||
if zallday:
|
||||
display_time = _("AllDay , %s") % (date_str)
|
||||
elif zduration < 24:
|
||||
duration = date + timedelta(hours=zduration)
|
||||
display_time = _("%s at (%s To %s) (%s)") % (date_str, time_str, duration.strftime(format_time), timezone)
|
||||
duration_time = duration.strftime(format_time).decode('utf-8')
|
||||
display_time = _(u"%s at (%s To %s) (%s)") % (
|
||||
date_str,
|
||||
time_str,
|
||||
duration_time,
|
||||
timezone,
|
||||
)
|
||||
else:
|
||||
display_time = _("%s at %s To\n %s at %s (%s)") % (date_str, time_str, date_deadline.strftime(format_date), date_deadline.strftime(format_time), timezone)
|
||||
dd_date = date_deadline.strftime(format_date).decode('utf-8')
|
||||
dd_time = date_deadline.strftime(format_time).decode('utf-8')
|
||||
display_time = _(u"%s at %s To\n %s at %s (%s)") % (
|
||||
date_str,
|
||||
time_str,
|
||||
dd_date,
|
||||
dd_time,
|
||||
timezone,
|
||||
)
|
||||
return display_time
|
||||
|
||||
def _get_duration(self, start, stop):
|
||||
|
||||
Reference in New Issue
Block a user