[PATCH 1 of 2 eac] [dataimport] Fix access to element's line number

Sylvain Thenault sylvain.thenault at logilab.fr
Thu May 18 16:51:52 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1495118240 -7200
#      Thu May 18 16:37:20 2017 +0200
# Node ID d229d8bfabd6a3e7e227b39ead0e6a46d1bd6b63
# Parent  530c2670514c9c7aa583f8a42af8190cd7ffcd95
[dataimport] Fix access to element's line number

correct attribute is `sourceline`, not `line`.

diff --git a/cubicweb_eac/dataimport.py b/cubicweb_eac/dataimport.py
--- a/cubicweb_eac/dataimport.py
+++ b/cubicweb_eac/dataimport.py
@@ -118,11 +118,11 @@ def add_xml_wrap_for(*etypes):
                 if nchildren >= 1:
                     xmlwrap = objectXMLWrap[0]
                 if nchildren > 1:
                     msg = self._('multiple children elements found in {0}').format(
                         objectXMLWrap)
-                    self.import_log.record_warning(msg, line=objectXMLWrap.line)
+                    self.import_log.record_warning(msg, line=objectXMLWrap.sourceline)
             attribute_added = False
             for extentity in func(self, elem):
                 if xmlwrap is not None and extentity.etype in etypes:
                     # prevent association of xmlwrap to several extentities.
                     assert not attribute_added, 'xml_wrap attribute already added'


More information about the saem-devel mailing list