def as_html(self): """Different attributes that can be used when generating a html file from a template for the archives.""" d = self.__dict__.copy() # avoid i18n side-effects otrans = i18n.get_translation() i18n.set_language(self._lang) try: d["prev"], d["prev_wsubj"] = self._get_prev() d["next"], d["next_wsubj"] = self._get_next() d["email_html"] = self.quote(self.email) d["title"] = self.quote(self.subject) d["subject_html"] = self.quote(self.subject) # TK: These two _url variables are used to compose a response # from the archive web page. So, ... # Possibly remove since not used?? d["subject_url"] = url_quote('Re: ' + self.subject) d["in_reply_to_url"] = url_quote(self._message_id) if mm_cfg.ARCHIVER_OBSCURES_EMAILADDRS: # Point the mailto url back to the list author = re.sub('@', _(' at '), self.author) emailurl = self._mlist.GetListEmail() else: author = self.author emailurl = self.email d["author_html"] = self.quote(author) d["email_url"] = url_quote(emailurl) d["datestr_html"] = self.quote(i18n.ctime(int(self.date))) d["body"] = self._get_body() d['listurl'] = self._mlist.GetScriptURL('listinfo', absolute=1) d['listname'] = self._mlist.real_name d['encoding'] = '' try: # This should work after a couple of emails has been send and the thread # address has been set, but to not get an error in the beginning the error # is caught and an already existing address is provided. Is for dlists. d['thread_addr'] = self.thread_addr d['thread_addr_at'] = re.sub('@', _(' at '), self.thread_addr) except: d['thread_addr'] = d["email_url"] d['thread_addr_at'] = d["email_url"] finally: i18n.set_translation(otrans) charset = Utils.GetCharSet(self._lang) d["encoding"] = html_charset % charset self._add_decoded(d) return quick_maketext( 'article.html', d, lang=self._lang, mlist=self._mlist)
def as_html(self): d = self.__dict__.copy() # avoid i18n side-effects otrans = i18n.get_translation() i18n.set_language(self._lang) try: d["prev"], d["prev_wsubj"] = self._get_prev() d["next"], d["next_wsubj"] = self._get_next() d["email_html"] = self.quote(self.email) d["title"] = self.quote(self.subject) d["subject_html"] = self.quote(self.subject) d["message_id"] = self.quote(self._message_id) # TK: These two _url variables are used to compose a response # from the archive web page. So, ... d["subject_url"] = url_quote('Re: ' + self.subject) d["in_reply_to_url"] = url_quote(self._message_id) if mm_cfg.ARCHIVER_OBSCURES_EMAILADDRS: # Point the mailto url back to the list author = re.sub('@', _(' at '), self.author) emailurl = self._mlist.GetListEmail() else: author = self.author emailurl = self.email d["author_html"] = self.quote(author) d["email_url"] = url_quote(emailurl) d["datestr_html"] = self.quote(i18n.ctime(int(self.date))) d["body"] = self._get_body() d['listurl'] = self._mlist.GetScriptURL('listinfo', absolute=1) d['listname'] = self._mlist.real_name d['encoding'] = '' finally: i18n.set_translation(otrans) charset = Utils.GetCharSet(self._lang) d["encoding"] = html_charset % charset self._add_decoded(d) return quick_maketext('article.html', d, lang=self._lang, mlist=self._mlist)
def as_html(self): d = self.__dict__.copy() # avoid i18n side-effects otrans = i18n.get_translation() i18n.set_language(self._lang) try: d["prev"], d["prev_wsubj"] = self._get_prev() d["next"], d["next_wsubj"] = self._get_next() d["email_html"] = self.quote(self.email) d["title"] = self.quote(self.subject) d["subject_html"] = self.quote(self.subject) d["message_id"] = self.quote(self._message_id) # TK: These two _url variables are used to compose a response # from the archive web page. So, ... d["subject_url"] = url_quote('Re: ' + self.subject) d["in_reply_to_url"] = url_quote(self._message_id) if mm_cfg.ARCHIVER_OBSCURES_EMAILADDRS: # Point the mailto url back to the list author = re.sub('@', _(' at '), self.author) emailurl = self._mlist.GetListEmail() else: author = self.author emailurl = self.email d["author_html"] = self.quote(author) d["email_url"] = url_quote(emailurl) d["datestr_html"] = self.quote(i18n.ctime(int(self.date))) d["body"] = self._get_body() d['listurl'] = self._mlist.GetScriptURL('listinfo', absolute=1) d['listname'] = self._mlist.real_name d['encoding'] = '' finally: i18n.set_translation(otrans) charset = Utils.GetCharSet(self._lang) d["encoding"] = html_charset % charset self._add_decoded(d) return quick_maketext( 'article.html', d, lang=self._lang, mlist=self._mlist)
def quotetime(s): return html_quote(i18n.ctime(s), self.lang)