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() from Products.PythonScripts.standard import Object
portal = context.getPortalObject()
from DateTime import DateTime from DateTime import DateTime
from hashlib import md5
portal = context.getPortalObject()
web_site = None
url = None url = None
if web_site is not None: if context.getPortalType() in ["Web Site", "Web Section"]:
url = web_site.getLayoutProperty("configuration_slapos_master_web_url", default=None) 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(): 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) description = "Please replace the url %s by %s on this feed url" % (portal.absolute_url(), url)
else: else:
url = portal.absolute_url() url = context.REQUEST.get('URL', context.absolute_url())
description = "This RSS is disabled." 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 [ return [Object(**{
newTempBase(context, 'please_migrate', **{"title": "This RSS is disabled.", 'title': "This RSS is disabled (%s)" % date_id,
"url_string": "%s?%s" % (url, DateTime().strftime("%Y%m%d")), 'category': 'Disabled',
"modification_date": DateTime().earliestTime(), 'author': 'Administrator',
"description": description})] '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 @@ ...@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key> <key> <string>delegated_list</string> </key>
<value> <value>
<list> <list>
<string>all_columns</string>
<string>columns</string> <string>columns</string>
<string>count_method</string> <string>count_method</string>
<string>default_params</string> <string>default_params</string>
...@@ -114,6 +115,12 @@ ...@@ -114,6 +115,12 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>all_columns</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>columns</string> </key> <key> <string>columns</string> </key>
<value> <value>
...@@ -123,16 +130,28 @@ ...@@ -123,16 +130,28 @@
<string>Title</string> <string>Title</string>
</tuple> </tuple>
<tuple> <tuple>
<string>modification_date</string> <string>guid</string>
<string>guid</string>
</tuple>
<tuple>
<string>pubDate</string>
<string>pubDate</string> <string>pubDate</string>
</tuple> </tuple>
<tuple> <tuple>
<string>description</string> <string>description</string>
<string>Description</string> <string>description</string>
</tuple> </tuple>
<tuple> <tuple>
<string>url_string</string>
<string>link</string> <string>link</string>
<string>link</string>
</tuple>
<tuple>
<string>author</string>
<string>author</string>
</tuple>
<tuple>
<string>thumbnail</string>
<string>thumbnail</string>
</tuple> </tuple>
</list> </list>
</value> </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