diff donations/management/commands/donations_report.py @ 684:161b56849114

For Django 1.5: management commands should use self.stdout, etc. for output. Note that I did not update the legacy commands since it is likely I will never run or test these commands again.
author Brian Neal <bgneal@gmail.com>
date Fri, 23 Aug 2013 19:17:40 -0500
parents 08d83015e15d
children
line wrap: on
line diff
--- a/donations/management/commands/donations_report.py	Fri Aug 23 19:02:45 2013 -0500
+++ b/donations/management/commands/donations_report.py	Fri Aug 23 19:17:40 2013 -0500
@@ -32,9 +32,9 @@
 
         max_month = 12 if year != today.year else today.month
 
-        print ROW_FMT % ('Month', 'Gross', 'Net')
+        self.stdout.write(ROW_FMT % ('Month', 'Gross', 'Net'))
         sep = ROW_FMT % ('-' * 10, '-' * 7, '-' * 7)
-        print sep
+        self.stdout.write(sep)
 
         total_gross = decimal.Decimal()
         total_net = decimal.Decimal()
@@ -54,10 +54,10 @@
 
             d = datetime.date(year=year, month=month, day=1)
 
-            print ROW_FMT % (d.strftime('%b %Y'), gross, net)
+            self.stdout.write(ROW_FMT % (d.strftime('%b %Y'), gross, net))
 
             total_gross += gross
             total_net += net
 
-        print sep
-        print ROW_FMT % ('Total:', total_gross, total_net)
+        self.stdout.write(sep)
+        self.stdout.write(ROW_FMT % ('Total:', total_gross, total_net))