comparison roundup/hyperdb.py @ 6183:bb198596f85c

Fix __repr__ of hyperdb.Class If a error occurs during schema parsing, classname isn't known yet, account for this case in __repr__.
author Ralf Schlatterbeck <rsc@runtux.com>
date Wed, 20 May 2020 10:21:12 +0200
parents a701c9c81597
children f40c6b5de370
comparison
equal deleted inserted replaced
6182:acb9841bb4fd 6183:bb198596f85c
1074 self.auditors = dict([(a, PrioList()) for a in actions]) 1074 self.auditors = dict([(a, PrioList()) for a in actions])
1075 self.reactors = dict([(a, PrioList()) for a in actions]) 1075 self.reactors = dict([(a, PrioList()) for a in actions])
1076 1076
1077 def __repr__(self): 1077 def __repr__(self):
1078 """Slightly more useful representation 1078 """Slightly more useful representation
1079 """ 1079 Note that an error message can be raised at a point
1080 return '<hyperdb.Class "%s">' % self.classname 1080 where self.classname isn't known yet if the error
1081 occurs during schema parsing.
1082 """
1083 cn = getattr (self, 'classname', 'Unknown')
1084 return '<hyperdb.Class "%s">' % cn
1081 1085
1082 # Editing nodes: 1086 # Editing nodes:
1083 1087
1084 def create(self, **propvalues): 1088 def create(self, **propvalues):
1085 """Create a new node of this class and return its id. 1089 """Create a new node of this class and return its id.

Roundup Issue Tracker: http://roundup-tracker.org/