[checker] improve a bit the displayed errors (closes #229593)

authorDavid Douard <david.douard@logilab.fr>
changeset1a74ce397fef
branchdefault
phasepublic
hiddenno
parent revision#bb06dc4524f5 Correct the VAT rate (#198866)
child revision#d5ea52e6532f Fix commands testing
files modified by this revision
readers/projman_checkers.py
# HG changeset patch
# User David Douard <david.douard@logilab.fr>
# Date 1395008341 -3600
# Sun Mar 16 23:19:01 2014 +0100
# Node ID 1a74ce397feffcbab3b49c752bd81e566487c58d
# Parent bb06dc4524f51c39acbf8719c36ac5f5e6ed6a43
[checker] improve a bit the displayed errors (closes #229593)

diff --git a/readers/projman_checkers.py b/readers/projman_checkers.py
@@ -142,12 +142,13 @@
1          return self._ignore_children_flag
2 
3      def _error(self, msg):
4          pos = [ p for p,n in self.stack ]
5          pos = [0]+pos[:-1]
6 -        tag = [ n.tag for p,n in self.stack]
7 -        path = "/".join( [ t+"[%s]"%p for t,p in zip(tag,pos) ] )
8 +        tag = [n.tag for p,n in self.stack]
9 +        ids = [n.get('id', pos[i]) for i, (p, n) in enumerate(self.stack)]
10 +        path = "/".join( [ t+"[%s]"%(i) for t, p, i in zip(tag, pos, ids) ] )
11          self._errors.append( "%s:%s" % (path,msg) )
12 
13      def __str__(self):
14          return "\n".join(self._errors)
15