Commit c0b712a8 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_rss_style: Update get legacy messages

  Clean up and update script to reflect the current usage
   Use Object rather newTempBase, so listbox columns are simpler to read
parent 9d5ba7e7
web_site = context.getWebSiteValue()
portal = context.getPortalObject()
from Products.PythonScripts.standard import Object
from DateTime import DateTime
from hashlib import md5
portal = context.getPortalObject()
web_site = None
url = None
if web_site is not None:
if context.getPortalType() in ["Web Site", "Web Section"]:
web_site = context.getWebSiteValue()
if web_site is not None:
url = web_site.getLayoutProperty("configuration_slapos_master_web_url", default=None)
if url is not None and url != portal.absolute_url():
description = "Please replace the url %s by %s on this feed url" % (portal.absolute_url(), url)
else:
url = portal.absolute_url()
description = "This RSS is disabled."
url = context.REQUEST.get('URL', context.absolute_url())
description = """
This RSS feed is disabled:
%s?...
Please remove it from your RSS reader, and use the global feed instead in order to get updates.
""" % url
from Products.ERP5Type.Document import newTempBase
# Use date to ensure it changes every day.
date_id = DateTime().strftime("%Y%m%d")
return [
newTempBase(context, 'please_migrate', **{"title": "This RSS is disabled.",
"url_string": "%s?%s" % (url, DateTime().strftime("%Y%m%d")),
"modification_date": DateTime().earliestTime(),
"description": description})]
return [Object(**{
'title': "This RSS is disabled (%s)" % date_id,
'category': 'Disabled',
'author': 'Administrator',
'link': "%s?date=%s" % (url, date_id),
'pubDate': DateTime().earliestTime(),
'guid': md5("%s-%s" % (url, date_id)).hexdigest(),
'description': description,
'thumbnail': ( None)})
]
......@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>all_columns</string>
<string>columns</string>
<string>count_method</string>
<string>default_params</string>
......@@ -114,6 +115,12 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>all_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>columns</string> </key>
<value>
......@@ -123,16 +130,28 @@
<string>Title</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>guid</string>
<string>guid</string>
</tuple>
<tuple>
<string>pubDate</string>
<string>pubDate</string>
</tuple>
<tuple>
<string>description</string>
<string>Description</string>
<string>description</string>
</tuple>
<tuple>
<string>url_string</string>
<string>link</string>
<string>link</string>
</tuple>
<tuple>
<string>author</string>
<string>author</string>
</tuple>
<tuple>
<string>thumbnail</string>
<string>thumbnail</string>
</tuple>
</list>
</value>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment