Skip to content

Commit 6ab1c48

Browse files
committed
Fix __repr__ of hyperdb.Class
If a error occurs during schema parsing, classname isn't known yet, account for this case in __repr__.
1 parent b264181 commit 6ab1c48

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

roundup/hyperdb.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,8 +1076,12 @@ def __init__(self, db, classname, **properties):
10761076

10771077
def __repr__(self):
10781078
"""Slightly more useful representation
1079+
Note that an error message can be raised at a point
1080+
where self.classname isn't known yet if the error
1081+
occurs during schema parsing.
10791082
"""
1080-
return '<hyperdb.Class "%s">' % self.classname
1083+
cn = getattr (self, 'classname', 'Unknown')
1084+
return '<hyperdb.Class "%s">' % cn
10811085

10821086
# Editing nodes:
10831087

0 commit comments

Comments
 (0)