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 9
9
10
10
from . import dtypes
11
11
12
+ try :
13
+ unicode = unicode
14
+ except NameError :
15
+ unicode = str
16
+
12
17
LABEL_ERROR = 'error'
13
18
LABEL_WARNING = 'warning'
14
19
@@ -83,9 +88,15 @@ def path(self):
83
88
return self .obj .get_path ()
84
89
85
90
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 )
89
100
90
101
91
102
class Validation (object ):
You can’t perform that action at this time.
0 commit comments