Commits

Michael P. Jung  committed a5795af

Add Python 3 support

  • Participants
  • Parent commits de064d8

Comments (0)

Files changed (4)

File dinbrief/invoice/invoice.py

                 vat_item = VatItem(rate=item.vat_rate)
                 d[item.vat_rate] = vat_item
             vat_item.amount += item.vat_rate * item.subtotal
-        self.vat_items = d.values()
-        self.vat_items.sort(key=lambda item: item.rate)
+        self.vat_items = sorted(d.values(), key=lambda item: item.rate)
 
     @property
     def gross(self):

File dinbrief/invoice/item_table.py

             if not (item.period or item.date):
                 style.append(('SPAN', (1, row), (2, row)))
             yield (
-                Number(unicode(item.position)),
+                Number(u'%s' % item.position),
                 Cell(escape(item.text)),
                 Cell(escape(item.period) if item.period else
                      escape(date_format(item.date, 'SHORT_DATE_FORMAT')) if item.date else u''),

File dinbrief/optional_django.py

     from django.utils.formats import date_format
 except ImportError:
     def date_format(value, format=None):
-        return unicode(value)
+        return u'%s' % value
 FOOD_VAT = Decimal('0.07')
 DEFAULT_VAT = Decimal('0.19')
 
-with file('test.pdf', 'w') as fh:
+with open('test.pdf', 'wb') as fh:
     invoice = Invoice(
         items=[
             Item(1, u'Donut', price=Decimal('1.00'), vat_rate=FOOD_VAT, quantity=100),