def getVars(self): vars = wcomponents.WTemplated.getVars(self) vars['timezone'] = self._conf.as_event.display_tzinfo.zone description = self._conf.as_event.description.encode('utf-8') vars["description_html"] = isStringHTML(description) vars["description"] = description event = self._conf.as_event start_dt_local = event.start_dt_display.astimezone( event.display_tzinfo) end_dt_local = event.end_dt_display.astimezone(event.display_tzinfo) fsdate, fedate = format_date( start_dt_local, format='medium'), format_date(end_dt_local, format='medium') fstime, fetime = start_dt_local.strftime( "%H:%M"), end_dt_local.strftime("%H:%M") vars["dateInterval"] = (fsdate, fstime, fedate, fetime) vars["address"] = None vars["room"] = None vars["attachments"] = self._conf.as_event.attached_items vars["conf"] = self._conf vars["event"] = self._conf.as_event info = self._conf.as_event.additional_info vars["moreInfo_html"] = isStringHTML(info) vars["moreInfo"] = info vars["actions"] = '' vars["isSubmitter"] = self._conf.as_event.can_manage( session.user, 'submit') return vars
def escape(text): if text is None: text = "" try: if isStringHTML(text): text = sanitize_for_platypus(text) else: text = cgi.escape(text) text = text.replace("\r\n", " <br/>") text = text.replace("\n", " <br/>") text = text.replace("\r", " <br/>") return text except Exception: return saxutils.escape(text)