Пример #1
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars( self )
        vars["logo"] = ""
        if self.event.has_logo:
            vars["logoURL"] = self.event.logo_url
            vars["logo"] = '<img src="{}" alt="{}" border="0" class="confLogo">'.format(
                vars["logoURL"], escape_html(self.event.title.encode('utf-8'), escape_quotes=True))
        vars["confTitle"] = self.event.title.encode('utf-8')
        vars["displayURL"] = self.event.url
        start_dt_local = self.event.start_dt_display.astimezone(self.event.display_tzinfo)
        end_dt_local = self.event.end_dt_display.astimezone(self.event.display_tzinfo)
        vars["timezone"] = self.event.display_tzinfo.zone
        vars["confDateInterval"] = _("from {start} to {end}").format(start=format_date(start_dt_local, format='long'),
                                                                     end=format_date(end_dt_local, format='long'))
        if start_dt_local.strftime("%d%B%Y") == end_dt_local.strftime("%d%B%Y"):
            vars["confDateInterval"] = format_date(start_dt_local, format='long')
        elif start_dt_local.strftime("%B%Y") == end_dt_local.strftime("%B%Y"):
            vars["confDateInterval"] = "%s-%s %s" % (start_dt_local.day, end_dt_local.day,
                                                     format_date(start_dt_local, format='MMMM yyyy'))
        vars["confLocation"] = self.event.venue_name
        vars["body"] = self._body
        vars['menu'] = menu_entries_for_event(self.event)

        vars["bgColorCode"] = layout_settings.get(self._conf, 'header_background_color').replace("#", "")
        vars["textColorCode"] = layout_settings.get(self._conf, 'header_text_color').replace("#", "")

        vars["confId"] = self._conf.id
        vars["conf"] = self._conf
        return vars
Пример #2
0
 def _escapeHTML(params, doNotSanitize=[]):
     index = 0
     for i in params:
         if i in doNotSanitize:
             continue
         # params can be a list or a dictonary
         # we need to define k depending if it is a list or a dictonary
         # in order to be able to do such a operation: params[k] = something.
         if isinstance(params, dict):
             param = params[i]
             k = i
         else:
             param = i
             k = index  # since we are  looping a list, we need to increment the index to
             index += 1 # get the correct 'k' in the next iteration.
         if isinstance(param, str):
             params[k] = escape_html(param)
         elif isinstance(param, list) or isinstance(param, dict):
             Sanitization._escapeHTML(param)
Пример #3
0
 def _escapeHTML(params, doNotSanitize=[]):
     index = 0
     for i in params:
         if i in doNotSanitize:
             continue
         # params can be a list or a dictonary
         # we need to define k depending if it is a list or a dictonary
         # in order to be able to do such a operation: params[k] = something.
         if isinstance(params, dict):
             param = params[i]
             k = i
         else:
             param = i
             k = index  # since we are  looping a list, we need to increment the index to
             index += 1 # get the correct 'k' in the next iteration.
         if isinstance(param, str):
             params[k] = escape_html(param)
         elif isinstance(param, list) or isinstance(param, dict):
             Sanitization._escapeHTML(param)