def webversion(self): obj = self.presscontent context_content = self._dynamic_content(obj) output_file = self._render_output_html() output_html = self._compose_email_content(output_file, context_content) rendered = self._exchange_relative_urls(output_html) html = rendered["html"] rendered_email = postprocess_emailtemplate(html) css_file = self.default_data["stylesheet"] text = rendered_email.replace("[[PC_CSS]]", str(css_file)) return text
def _exchange_relative_urls(self, output_html): """ exchange relative URLs and return dict with html, plain and images """ parser_output_zpt = SafeHTMLParser(self) parser_output_zpt.feed(output_html) text_raw = parser_output_zpt.html text_raw_clean = text_raw.replace('\r', '') text = postprocess_emailtemplate(text_raw_clean) text_plain = self.create_plaintext_message(text) image_urls = parser_output_zpt.image_urls return dict(html=text, plain=text_plain, images=image_urls)