[Erp5-report] r12526 - /erp5/trunk/products/ERP5Type/DateUtils.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Feb 2 14:33:04 CET 2007


Author: jerome
Date: Fri Feb  2 14:33:03 2007
New Revision: 12526

URL: http://svn.erp5.org?rev=12526&view=rev
Log:
roundDate is useless


Modified:
    erp5/trunk/products/ERP5Type/DateUtils.py

Modified: erp5/trunk/products/ERP5Type/DateUtils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/DateUtils.py?rev=12526&r1=12525&r2=12526&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/DateUtils.py (original)
+++ erp5/trunk/products/ERP5Type/DateUtils.py Fri Feb  2 14:33:03 2007
@@ -25,6 +25,8 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 ##############################################################################
+
+import warnings
 
 from AccessControl import ModuleSecurityInfo
 from DateTime import DateTime
@@ -254,8 +256,8 @@
   Returns a year fraction according to accounting rules,
   i.e. 30 days per month
   """
-  from_date = roundDate(from_date)
-  to_date = roundDate(to_date)
+  from_date = from_date.earliestTime()
+  to_date = to_date.earliestTime()
   
   months = getMonthAndDaysBetween(from_date, to_date)['month']
   days = getMonthAndDaysBetween(from_date, to_date)['day']
@@ -332,4 +334,6 @@
   """
   Returns a date at 0:00
   """
-  return DateTime('%s/%s/%s' % (date.year(), date.month(), date.day()))
+  warnings.warn('ERP5Type.DateUtils.roundDate is deprecated, use'
+                ' DateTime.earliestTime instead', DeprecationWarning)
+  return date.earliestTime()




More information about the Erp5-report mailing list