[Erp5-report] r34561 fabien - in /erp5/trunk/bt5/erp5_base: SkinTemplateItem/portal_skins/e...
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Apr 14 16:38:57 CEST 2010
Author: fabien
Date: Wed Apr 14 16:38:56 2010
New Revision: 34561
URL: http://svn.erp5.org?rev=34561&view=rev
Log:
move Base_getDiffBetweenDateAndNow from erp5_gadget to erp5_base as it is context independent and can be useful in many other situation than gadget (like reports, ...)
Added:
erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getDiffBetweenDateAndNow.xml
Modified:
erp5/trunk/bt5/erp5_base/bt/revision
Added: erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getDiffBetweenDateAndNow.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getDiffBetweenDateAndNow.xml?rev=34561&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getDiffBetweenDateAndNow.xml (added)
+++ erp5/trunk/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getDiffBetweenDateAndNow.xml [utf8] Wed Apr 14 16:38:56 2010
@@ -1,0 +1,171 @@
+<?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>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[
+
+import DateTime\n
+if not date:\n
+ return date\n
+try:\n
+ now = DateTime.DateTime(DateTime.now())\n
+ date = DateTime.DateTime(date)\n
+except :\n
+ return date \n
+diff = now - date\n
+if diff < 1:\n
+ hours = diff*24.0\n
+ if hours < 1:\n
+ minutes = hours*60.0\n
+ if minutes < 1:\n
+ seconds = minutes*60.0\n
+ if seconds < 1:\n
+ return \'Now\'\n
+ if 2 > seconds > 1: \n
+ return str(int(seconds)) +\' second ago\'\n
+ return str(int(seconds)) +\' seconds ago\' \n
+ if 2 > minutes > 1:\n
+ return str(int(minutes)) +\' minute ago\' \n
+ return str(int(minutes)) +\' minutes ago\' \n
+ if 2 > hours > 1:\n
+ return str(int(hours)) +\' hour ago\' \n
+ return str(int(hours)) +\' hours ago\'\n
+else:\n
+ if diff > 365.25:\n
+ return \'More than 1 year\'\n
+ elif diff > 30:\n
+ return \'More than 1 month\'\n
+ elif 2 > diff > 1:\n
+ return \'Yesterday\'\n
+ return str(int(diff))+\' days ago\'\n
+
+
+]]></string> </value>
+ </item>
+ <item>
+ <key> <string>_code</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string>date</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>1</int> </value>
+ </item>
+ <item>
+ <key> <string>co_varnames</string> </key>
+ <value>
+ <tuple>
+ <string>date</string>
+ <string>DateTime</string>
+ <string>_getattr_</string>
+ <string>now</string>
+ <string>diff</string>
+ <string>hours</string>
+ <string>minutes</string>
+ <string>seconds</string>
+ <string>str</string>
+ <string>int</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_getDiffBetweenDateAndNow</string> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string>Return diff between the date pass in parameter and current date</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: erp5/trunk/bt5/erp5_base/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_base/bt/revision?rev=34561&r1=34560&r2=34561&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_base/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_base/bt/revision [utf8] Wed Apr 14 16:38:56 2010
@@ -1,1 +1,1 @@
-716
+712
More information about the Erp5-report
mailing list