Commit 0b39d728 authored by Ivan Tyagov's avatar Ivan Tyagov

Refactored erp5_rss_style bt5 by zstoinov.

-  Add dedicated form_render in RSS (rss_view) which can be used to hard code that a form must be rendered in RSS

- Make it possible to really render *any* existing form in RSS by setting dynamically in URL 'portal_skin=RSS '

- Use proper html_quote function

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22542 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9d508dd6
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="Folder" module="OFS.Folder"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_rss_core</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<?xml version="1.0"?>\n
<rss version="2.0" metal:define-macro="master"\n
xmlns:tal="http://xml.zope.org/namespaces/tal" \n
xmlns:metal="http://xml.zope.org/namespaces/metal"\n
xmlns:dc="http://purl.org/dc/elements/1.1/" \n
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">\n
<tal:block tal:define="dummy python: request.RESPONSE.setHeader(\'Content-Type\', \'application/rss+xml;; charset=utf-8\');\n
rss_string string:RSS;\n
dummy python: context.getPortalObject().portal_skins.changeSkin(rss_string);\n
dummy python: request.set(\'portal_skin\', rss_string);">\n
<tal:block tal:define="listbox_fields python: [field for field in form.get_fields() if (field.meta_type == \'ListBox\' or field.meta_type == \'ProxyField\' and field.getRecursiveTemplateField().meta_type == \'ListBox\')]" >\n
\n
<channel>\n
<title tal:content="here/Title">TITLE</title>\n
<link tal:content="here/absolute_url">URL</link>\n
<description tal:content="python: here.getProperty(\'description\')">DESCRIPTION</description>\n
<tal:block tal:repeat="listbox_field listbox_fields">\n
<tal:block tal:content="structure python: listbox_field.render()" />\n
</tal:block>\n
</channel>\n
\n
</tal:block>\n
</tal:block>\n
</rss>
]]></string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/xml; charset=utf-8</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rss_view</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="Folder" module="OFS.Folder"/>
<string>OFS.Folder</string> <tuple/>
<string>Folder</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -18,12 +15,43 @@ ...@@ -18,12 +15,43 @@
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_registered_skin_selections</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>tokens</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item> <item>
<key> <string>_objects</string> </key> <key> <string>_objects</string> </key>
<value> <value>
<tuple/> <tuple/>
</value> </value>
</item> </item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>business_template_registered_skin_selections</string> </key>
<value>
<tuple>
<string>RSS</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>erp5_rss_style</string> </value> <value> <string>erp5_rss_style</string> </value>
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -119,7 +116,7 @@ return context.getOwnerInfo().get(\'id\', \'\')\n ...@@ -119,7 +116,7 @@ return context.getOwnerInfo().get(\'id\', \'\')\n
<value> <value>
<tuple> <tuple>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -68,21 +65,14 @@ ...@@ -68,21 +65,14 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>"""\n
"""\n
Pre-process a description before putting it into RSS feed.\n Pre-process a description before putting it into RSS feed.\n
We html-quote all < and > because they\'d break the reader\n
(the > char is often found in mail messages).\n
"""\n """\n
from Products.PythonScripts.standard import html_quote\n
\n \n
description = context.getDescription()\n description = context.getDescription()\n
description = description.replace(\'>\', \'&gt;\')\n return html_quote(description)\n
description = description.replace(\'<\', \'&lt;\')\n </string> </value>
return description\n
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -124,8 +114,10 @@ return description\n ...@@ -124,8 +114,10 @@ return description\n
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>Products.PythonScripts.standard</string>
<string>html_quote</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>description</string> <string>description</string>
</tuple> </tuple>
</value> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
Pre-process a title before putting it into RSS feed.\n
"""\n
from Products.PythonScripts.standard import html_quote\n
\n
title = context.Title()\n
return html_quote(title)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>Products.PythonScripts.standard</string>
<string>html_quote</string>
<string>_getattr_</string>
<string>context</string>
<string>title</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getRSSTitle</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="ERP5Form" module="Products.ERP5Form.Form"/>
<string>Products.ERP5Form.Form</string> <tuple/>
<string>ERP5Form</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -49,6 +46,16 @@ ...@@ -49,6 +46,16 @@
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>encoding</string> </key> <key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value> <value> <string>UTF-8</string> </value>
...@@ -124,7 +131,7 @@ ...@@ -124,7 +131,7 @@
</item> </item>
<item> <item>
<key> <string>pt</string> </key> <key> <string>pt</string> </key>
<value> <string>template_rss_style</string> </value> <value> <string>rss_view</string> </value>
</item> </item>
<item> <item>
<key> <string>row_length</string> </key> <key> <string>row_length</string> </key>
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="ListBox" module="Products.ERP5Form.ListBox"/>
<string>Products.ERP5Form.ListBox</string> <tuple/>
<string>ListBox</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -321,33 +318,37 @@ ...@@ -321,33 +318,37 @@
<key> <string>alternate_name</string> </key> <key> <string>alternate_name</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>anchor</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>columns</string> </key> <key> <string>columns</string> </key>
<value> <value>
<list> <list>
<tuple> <tuple>
<string>Base_getRSSTitle</string>
<string>title</string> <string>title</string>
<string>rss_title</string>
</tuple> </tuple>
<tuple> <tuple>
<string>creation_date</string> <string>creation_date</string>
<string>rss_pubDate</string> <string>pubDate</string>
</tuple> </tuple>
<tuple> <tuple>
<string>Base_getRSSAuthor</string> <string>Base_getRSSAuthor</string>
<string>rss_author</string> <string>author</string>
</tuple> </tuple>
<tuple> <tuple>
<string>link</string> <string>link</string>
<string>rss_link</string> <string>link</string>
</tuple> </tuple>
<tuple> <tuple>
<string>Base_getRSSDescription</string> <string>Base_getRSSDescription</string>
<string>rss_description</string> <string>description</string>
</tuple> </tuple>
<tuple> <tuple>
<string>absolute_url</string> <string>absolute_url</string>
<string>rss_guid</string> <string>guid</string>
</tuple> </tuple>
</list> </list>
</value> </value>
...@@ -435,7 +436,7 @@ ...@@ -435,7 +436,7 @@
</item> </item>
<item> <item>
<key> <string>page_template</string> </key> <key> <string>page_template</string> </key>
<value> <string>Listbox_viewAsRSS</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>portal_types</string> </key> <key> <string>portal_types</string> </key>
...@@ -536,11 +537,8 @@ ...@@ -536,11 +537,8 @@
<record id="3" aka="AAAAAAAAAAM="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="Method" module="Products.Formulator.MethodField"/>
<string>Products.Formulator.MethodField</string> <tuple/>
<string>Method</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
<string>Products.PageTemplates.ZopePageTemplate</string> <tuple/>
<string>ZopePageTemplate</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -176,29 +173,17 @@ ...@@ -176,29 +173,17 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
<?xml version="1.0"?>\n <tal:block \n
<rss version="2.0" \n xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:dc="http://purl.org/dc/elements/1.1/" \n xmlns:i18n="http://xml.zope.org/namespaces/i18n"\n
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"\n tal:define="line_list here/query;\n
xmlns:tal="http://xml.zope.org/namespaces/tal">\n
<tal:block tal:define="\n
field_id here/getId;\n
line_list here/query;\n
label_list here/getLabelValueList;\n label_list here/getLabelValueList;\n
real_context here/getContext;\n real_context here/getContext;\n
feed_data python: real_context.Listbox_asRSS(label_list, line_list);\n feed_data python: real_context.Listbox_asRSS(label_list, line_list);">\n
">\n
<channel tal:define="channel_info feed_data/channel_info" >\n
<title tal:content="channel_info/title">TITLE</title>\n
<link tal:content="channel_info/url">URL</link>\n
<description tal:content="channel_info/description">DESCRIPTION</description>\n
<item tal:repeat="item_info feed_data/listItemInfos" >\n <item tal:repeat="item_info feed_data/listItemInfos" >\n
<tal:block tal:replace="structure item_info"/>\n <tal:block tal:replace="structure item_info"/>\n
</item>\n </item>\n
</channel>\n </tal:block>
</tal:block>\n
</rss>\n
]]></string> </value> ]]></string> </value>
</item> </item>
...@@ -212,7 +197,7 @@ ...@@ -212,7 +197,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Listbox_viewAsRSS</string> </value> <value> <string>ListBox_asHTML</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -72,9 +69,8 @@ ...@@ -72,9 +69,8 @@
"""\n """\n
A script for exporting listbox\'s contents as RSS feed.\n A script for exporting listbox\'s contents as RSS feed.\n
It is called by Listbox_viewAsRSS listbox renderer, which queries the listbox\n It is called by Listbox_asHTML(in RSS skin) listbox renderer, which queries the listbox\n
and passes on column labels and listbox renderer lines. Returns a dict containing\n and passes on column labels and listbox renderer lines. Returns a list\n
channel information (channel = context in which the form was called) and a list\n
of items as a piece of xml (because we have to manipulate tag names).\n of items as a piece of xml (because we have to manipulate tag names).\n
\n \n
The implementation is based on RSS 2.0 specification, in a somewhat simplified way \n The implementation is based on RSS 2.0 specification, in a somewhat simplified way \n
...@@ -84,13 +80,15 @@ ...@@ -84,13 +80,15 @@
\n \n
USAGE:\n USAGE:\n
The RSS skin is to be used to render a custom rss listbox, which must have columns\n The RSS skin is to be used to render a custom rss listbox, which must have columns\n
with titles beginning with "rss_". It is highly recommended to have the following:\n with following titles:\n
- rss_title\n - title\n
- rss_author\n - author\n
- rss_description\n - description\n
- rss_pubDate\n - category\n
- rss_link\n - comments\n
- rss_guid (which should be an absolute url of the document)\n - pubDate\n
- link\n
- guid (which should be an absolute url of the document)\n
The way an object is presented should be defined in the listbox - the RSS skin passes on\n The way an object is presented should be defined in the listbox - the RSS skin passes on\n
what is in the listbox, as is. So you can produce your own description, author information\n what is in the listbox, as is. So you can produce your own description, author information\n
or publication date. A partial exception to this rule is dates - RSS protocol requires\n or publication date. A partial exception to this rule is dates - RSS protocol requires\n
...@@ -99,53 +97,70 @@ ...@@ -99,53 +97,70 @@
publication date is entirely up to you.\n publication date is entirely up to you.\n
"""\n """\n
\n \n
allowed_field_list = (\'title\', \'link\', \'description\', \'author\', \'category\', \'comments\', \'guid\', \'pubDate\')\n
\n
from Products.CMFCore.utils import getToolByName\n from Products.CMFCore.utils import getToolByName\n
request = context.REQUEST\n from Products.PythonScripts.standard import html_quote\n
\n \n
channel = context\n items = []\n
feed_data = {}\n feed_data = {}\n
request = context.REQUEST\n
\n
# required channel elements for RSS 2.0 specification\n
required_field_list = (\'title\', \'description\', \'link\',)\n
\n \n
# channel information\n # required + optional channel elements\n
feed_data[\'channel_info\'] = { \'title\': channel.Title(),\n allowed_field_list = (\'title\', \'description\', \'link\', \'author\', \n
\'description\': channel.getProperty(\'description\'), # so that it works for portal object too\n \'category\', \'comments\', \'guid\', \'pubdate\',)\n
\'url\': channel.absolute_url() + \'/view\' }\n
\n \n
# figure out which column is which, by using column titles\n # figure out which column is which, by using column titles\n
rss_column_mapping = {}\n rss_column_mapping = {}\n
for index, column_item in enumerate(label_list):\n for index, column_item in enumerate(label_list):\n
column_header = column_item[1]\n column_header = column_item[1]\n
if column_header.startswith(\'rss_\'):\n if column_header.lower() in allowed_field_list:\n
field_name = column_header[4:]\n rss_column_mapping[column_header.lower()] = index\n
if field_name in allowed_field_list:\n
rss_column_mapping[field_name] = index\n
\n
items = []\n
\n \n
for line in line_list:\n for line in line_list:\n
column_item_list = line.getValueList()\n
rss_item_dict = {}\n rss_item_dict = {}\n
column_item_list = line.getValueList()\n
for header, index in rss_column_mapping.items():\n for header, index in rss_column_mapping.items():\n
value_tuple = column_item_list[index]\n value_tuple = column_item_list[index]\n
# the [0] is a raw value, the [1] is rendered; we want strings rendered (as unicode),\n # the [0] is a raw value, the [1] is rendered; we want strings rendered (as unicode),\n
# but other stuff (like int or DateTime) we want as they are\n # but other stuff (like int or DateTime) we want as they are\n
if hasattr(value_tuple[0], \'lower\'):\n if hasattr(value_tuple[0], \'lower\'):\n
value = value_tuple[1]\n value = html_quote(value_tuple[1])\n
else:\n else:\n
value = value_tuple[0]\n value = value_tuple[0]\n
# format dates\n
if hasattr(value, \'rfc822\'):\n if hasattr(value, \'rfc822\'):\n
# format dates\n
value = value.rfc822()\n value = value.rfc822()\n
rss_item_dict[header] = value\n rss_item_dict[header] = value\n
# build xml from dict (we have to do it here because we need to manipulate tag names\n # build xml from dict (we have to do it here because we need to manipulate tag names\n
rss_item_string = \'\'\n rss_item_string = \'\'\n
for k, v in rss_item_dict.items():\n for key, value in rss_item_dict.items():\n
rss_item_string += (\'<%s>%s</%s>\\n\' % (k,v or \'\',k))\n if key == \'pubdate\':\n
# pubDate should be returned unconditionally as \'pubDate\'\n
key = \'pubDate\'\n
rss_item_string += (\'\\t\\t\\t<%s>%s</%s>\\n\' % (key,value or \'\',key))\n
\n
# if required fields not present in listbox columns as label we \n
# added theirs appropriate xml dynamically\n
for required_field in required_field_list:\n
if required_field not in rss_item_dict.keys():\n
field_data = \'\'\n
if required_field == \'title\':\n
if hasattr(line.getBrain(), \'Title\'):\n
field_data = html_quote(unicode(line.getBrain().Title(), \'utf-8\') or \'\')\n
rss_item_string += (\'\\t\\t\\t<%s>%s</%s>\\n\' % (required_field, field_data, required_field))\n
elif required_field == \'link\':\n
if hasattr(line.getBrain(), \'absolute_url\'):\n
field_data = unicode(line.getBrain().absolute_url(), \'utf-8\' ) or \'\'\n
rss_item_string += (\'\\t\\t\\t<%s>%s/view</%s>\\n\' % (required_field, field_data, required_field))\n
elif required_field == \'description\':\n
if hasattr(line.getBrain(), \'getDescription\'):\n
field_data = html_quote(unicode(line.getBrain().getDescription(), \'utf-8\' ) or \'\')\n
rss_item_string += (\'\\t\\t\\t<%s>%s</%s>\\n\' % (required_field, field_data,required_field))\n
items.append(rss_item_string)\n items.append(rss_item_string)\n
\n \n
feed_data[\'listItemInfos\'] = tuple(items)\n feed_data[\'listItemInfos\'] = tuple(items)\n
\n
return feed_data\n return feed_data\n
...@@ -193,15 +208,17 @@ return feed_data\n ...@@ -193,15 +208,17 @@ return feed_data\n
<tuple> <tuple>
<string>label_list</string> <string>label_list</string>
<string>line_list</string> <string>line_list</string>
<string>allowed_field_list</string>
<string>Products.CMFCore.utils</string> <string>Products.CMFCore.utils</string>
<string>getToolByName</string> <string>getToolByName</string>
<string>Products.PythonScripts.standard</string>
<string>html_quote</string>
<string>items</string>
<string>feed_data</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>request</string>
<string>channel</string> <string>required_field_list</string>
<string>feed_data</string> <string>allowed_field_list</string>
<string>_write_</string>
<string>rss_column_mapping</string> <string>rss_column_mapping</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>enumerate</string> <string>enumerate</string>
...@@ -209,18 +226,20 @@ return feed_data\n ...@@ -209,18 +226,20 @@ return feed_data\n
<string>column_item</string> <string>column_item</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>column_header</string> <string>column_header</string>
<string>field_name</string> <string>_write_</string>
<string>items</string>
<string>line</string> <string>line</string>
<string>column_item_list</string>
<string>rss_item_dict</string> <string>rss_item_dict</string>
<string>column_item_list</string>
<string>header</string> <string>header</string>
<string>value_tuple</string> <string>value_tuple</string>
<string>hasattr</string> <string>hasattr</string>
<string>value</string> <string>value</string>
<string>rss_item_string</string> <string>rss_item_string</string>
<string>k</string> <string>key</string>
<string>v</string> <string>_inplacevar_</string>
<string>required_field</string>
<string>field_data</string>
<string>unicode</string>
<string>tuple</string> <string>tuple</string>
</tuple> </tuple>
</value> </value>
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
<string>Products.PageTemplates.ZopePageTemplate</string> <tuple/>
<string>ZopePageTemplate</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -48,18 +45,20 @@ ...@@ -48,18 +45,20 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
<tal:block tal:define="dummy python:request.RESPONSE.setHeader(\'Content-Type\', \'application/rss+xml;; charset=utf-8\');"\n <?xml version="1.0"?>\n
><tal:block tal:define="listbox python:form[\'listbox\'];" \n <tal:block \n
><tal:block tal:content="structure python: listbox.render()" />\n xmlns:tal="http://xml.zope.org/namespaces/tal" \n
</tal:block>\n xmlns:metal="http://xml.zope.org/namespaces/metal"\n
metal:use-macro="here/rss_view/macros/master" >\n
</tal:block>\n </tal:block>\n
\n
]]></string> </value> ]]></string> </value>
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
<value> <string>text/html</string> </value> <value> <string>text/xml; charset=utf-8</string> </value>
</item> </item>
<item> <item>
<key> <string>expand</string> </key> <key> <string>expand</string> </key>
...@@ -67,7 +66,7 @@ ...@@ -67,7 +66,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>template_rss_style</string> </value> <value> <string>form_list</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<?xml version="1.0"?>\n
<tal:block \n
xmlns:tal="http://xml.zope.org/namespaces/tal" \n
xmlns:metal="http://xml.zope.org/namespaces/metal"\n
metal:use-macro="here/rss_view/macros/master" >\n
</tal:block>\n
]]></string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/xml; charset=utf-8</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2008-07-14 zstoinov
* Make RSS skin more generic
2007-08-29 2007-08-29
Release-ready. * Release-ready.
2007-08-13 2007-08-13
First working version. * First working version.
\ No newline at end of file \ No newline at end of file
12 16
\ No newline at end of file \ No newline at end of file
erp5_rss_core
erp5_rss_style erp5_rss_style
\ No newline at end of file
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