Commit 2b1b9b17 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

WebSite_getFancyRelativeDate is just a duplicate. use Base_getDiffBetweenDateAndNow instead.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45709 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4a1d2813
...@@ -66,17 +66,17 @@ doc_info = {}\n ...@@ -66,17 +66,17 @@ doc_info = {}\n
doc_info[\'owner_list\'] = context.Base_getOwnerInfoList()\n doc_info[\'owner_list\'] = context.Base_getOwnerInfoList()\n
\n \n
if context.getModificationDate() is not None:\n if context.getModificationDate() is not None:\n
doc_info[\'modification_date\'] = context.WebSite_getFancyRelativeDate(context.getModificationDate())\n doc_info[\'modification_date\'] = context.Base_getDiffBetweenDateAndNow(context.getModificationDate())\n
\n \n
publication_date = context.Document_getLastWorkflowStateEntryDate(state=(\'public,\'),\n publication_date = context.Document_getLastWorkflowStateEntryDate(state=(\'public,\'),\n
state_name=\'validation_state\')\n state_name=\'validation_state\')\n
if publication_date is not None:\n if publication_date is not None:\n
doc_info[\'publication_date\'] = context.WebSite_getFancyRelativeDate(publication_date)\n doc_info[\'publication_date\'] = context.Base_getDiffBetweenDateAndNow(publication_date)\n
\n \n
release_date = context.Document_getLastWorkflowStateEntryDate(state=(\'released,\'),\n release_date = context.Document_getLastWorkflowStateEntryDate(state=(\'released,\'),\n
state_name=\'validation_state\')\n state_name=\'validation_state\')\n
if release_date is not None:\n if release_date is not None:\n
doc_info[\'release_date\'] = context.WebSite_getFancyRelativeDate(release_date)\n doc_info[\'release_date\'] = context.Base_getDiffBetweenDateAndNow(release_date)\n
\n \n
try:\n try:\n
doc_info[\'status\'] = context.getTranslatedValidationStateTitle() or \'\'\n doc_info[\'status\'] = context.getTranslatedValidationStateTitle() or \'\'\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </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 encoding="cdata"><![CDATA[
""" \n
Calculate and format the time difference between now and supplied date. \n
"""\n
\n
translateString = context.Base_translateString\n
dif = DateTime() - date_object\n
hour = 1.0 / 24\n
minute = 1.0 / (24 * 60)\n
if dif < 1:\n
if dif < hour:\n
return translateString("${timedif} min ago", mapping = {\'timedif\':int(dif / minute)})\n
return translateString("${timedif}h ago", mapping = {\'timedif\':int(dif / hour)})\n
if int(dif) == 1: \n
return translateString(\'1 day ago\')\n
return translateString("${timedif} days ago", mapping = {\'timedif\':int(dif)})\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>date_object</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSite_getFancyRelativeDate</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Generate relative fancy formatted date as string</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<li tal:repeat="newsitem python: news_list">\n <li tal:repeat="newsitem python: news_list">\n
<a tal:define="url python: \'%s/view\' % newsitem.absolute_url()"\n <a tal:define="url python: \'%s/view\' % newsitem.absolute_url()"\n
tal:attributes="href url">\n tal:attributes="href url">\n
<tal:block tal:replace="python: here.WebSite_getFancyRelativeDate(newsitem.getCreationDate())"\n <tal:block tal:replace="python: here.Base_getDiffBetweenDateAndNow(newsitem.getCreationDate())"\n
tal:on-error="string:"/>&mdash;\n tal:on-error="string:"/>&mdash;\n
<tal:block tal:replace="newsitem/getTitleOrId"\n <tal:block tal:replace="newsitem/getTitleOrId"\n
tal:on-error="string:"/>\n tal:on-error="string:"/>\n
...@@ -151,8 +151,7 @@ ...@@ -151,8 +151,7 @@
</div>\n </div>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>
]]></unicode> </value> ]]></unicode> </value>
</item> </item>
......
1044 1045
\ No newline at end of file \ 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