Browse Source

Futurize - mudanças python 3

pull/6/head
Danimar Ribeiro 9 years ago
parent
commit
1e94eb18ba
  1. 1
      pytrustnfe/nfe/assinatura.py
  2. 3
      pytrustnfe/nfse/assinatura.py
  3. 9
      pytrustnfe/xml/filters.py

1
pytrustnfe/nfe/assinatura.py

@ -2,6 +2,7 @@
# © 2016 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from builtins import object
import signxml
from lxml import etree
from pytrustnfe.certificado import extract_cert_and_key_from_pfx

3
pytrustnfe/nfse/assinatura.py

@ -5,6 +5,9 @@
import xmlsec
import libxml2
import os.path
from builtins import str
from builtins import range
from builtins import object
NAMESPACE_SIG = 'http://www.w3.org/2000/09/xmldsig#'

9
pytrustnfe/xml/filters.py

@ -2,6 +2,9 @@
# © 2016 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from __future__ import division
from builtins import str
from past.utils import old_div
from decimal import Decimal
from datetime import date
from datetime import datetime
@ -13,8 +16,8 @@ def normalize_str(string):
Remove special characters and return the ascii string
"""
if string:
if not isinstance(string, unicode):
string = unicode(string, 'utf-8', 'replace')
if not isinstance(string, str):
string = str(string, 'utf-8', 'replace')
string = string.encode('utf-8')
return normalize(
@ -24,7 +27,7 @@ def normalize_str(string):
def format_percent(value):
if value:
return Decimal(value) / 100
return old_div(Decimal(value), 100)
def format_datetime(value):

Loading…
Cancel
Save