File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 99
1010from . import dtypes
1111
12+ try :
13+ unicode = unicode
14+ except NameError :
15+ unicode = str
16+
1217LABEL_ERROR = 'error'
1318LABEL_WARNING = 'warning'
1419
@@ -83,9 +88,15 @@ def path(self):
8388 return self .obj .get_path ()
8489
8590 def __repr__ (self ):
86- return "<ValidationError(%s):%s '%s'>" % (self .rank ,
87- self .obj ,
88- self .msg )
91+ # Cleanup the odml object print strings
92+ print_str = unicode (self .obj ).split ()[0 ].split ("[" )[0 ].split (":" )[0 ]
93+ # Document has no name attribute and should not print id or name info
94+ if hasattr (self .obj , "name" ):
95+ if self .obj .name and self .obj .name != self .obj .id :
96+ print_str = "%s[%s]" % (print_str , self .obj .name )
97+ else :
98+ print_str = "%s[%s]" % (print_str , self .obj .id )
99+ return "Validation%s: %s '%s'" % (self .rank .capitalize (), print_str , self .msg )
89100
90101
91102class Validation (object ):
You can’t perform that action at this time.
0 commit comments