Browse Source

Merge branch 'master' of https://github.com/leotada/PyNFe

tags/0.3.10
Junior Tada 9 years ago
parent
commit
b1e8e1c04f
  1. 4
      pynfe/processamento/assinatura.py

4
pynfe/processamento/assinatura.py

@ -35,7 +35,11 @@ class AssinaturaA1(Assinatura):
etree.SubElement(siginfo, 'SignatureMethod', Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1') etree.SubElement(siginfo, 'SignatureMethod', Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1')
# Tenta achar a tag infNFe # Tenta achar a tag infNFe
try: try:
if len(xml.nsmap.items()) == 0: # não tem namespace
ref = etree.SubElement(siginfo, 'Reference', URI='#'+xml.findall('infNFe')[0].attrib['Id']) ref = etree.SubElement(siginfo, 'Reference', URI='#'+xml.findall('infNFe')[0].attrib['Id'])
else:
ns = {'ns': 'http://www.portalfiscal.inf.br/nfe'}
ref = etree.SubElement(siginfo, 'Reference', URI='#'+xml.findall('ns:infNFe', namespaces=ns)[0].attrib['Id'])
# Caso nao tenha a tag infNFe, procura a tag infEvento # Caso nao tenha a tag infNFe, procura a tag infEvento
except IndexError: except IndexError:
try: try:

Loading…
Cancel
Save