-
Notifications
You must be signed in to change notification settings - Fork 23
/
issue.py
37 lines (31 loc) · 1.25 KB
/
issue.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from BeautifulSoup import BeautifulSoup
from Products.CMFCore.utils import getToolByName
from Products.Five.browser import BrowserView
from Products.EasyNewsletter import EasyNewsletterMessageFactory as _
from Products.EasyNewsletter.config import PLACEHOLDERS
class IssueView(BrowserView):
"""
"""
def refresh_issue(self):
"""Refresh the aggregate body when using collections.
"""
if self.context.getAcquireCriteria():
self.context.loadContent()
self.request.response.redirect(self.context.absolute_url())
def send_issue(self):
"""
"""
putils = getToolByName(self.context, "plone_utils")
self.context.send()
putils.addPortalMessage(_("The issue has been send."))
return self.request.response.redirect(self.context.absolute_url())
def get_public_body(self):
""" Return the rendered HTML version without placeholders.
"""
html = self.context._render_output_html()
for placeholder in PLACEHOLDERS:
html = html.replace('[[' + placeholder + ']]', '')
soup = BeautifulSoup(html)
for node in soup.findAll('div', {'class': 'mailonly'}):
node.extract()
return soup.renderContents()