logging needs to be updated for non-booleanable? tables
Issue #1620
resolved
This code breaks when DEBUG logging is turned all the way on because it can't get the boolean value of a Table. Should it really check for 'is not None'?
Index: orm/mapper.py
===================================================================
--- orm/mapper.py (revision 6510)
+++ orm/mapper.py (working copy)
@@ -735,8 +735,8 @@
self.logger.info(
"(" + self.class_.__name__ +
"|" +
- (self.local_table and self.local_table.description or str(self.local_table)) +
- (self.non_primary and "|non-primary" or "") + ") " +
+ (self.local_table is not None and self.local_table.description or str(self.local_table)) +
+ (self.non_primary is not None and "|non-primary" or "") + ") " +
msg)
def _log_debug(self, msg):
@@ -744,8 +744,8 @@
self.logger.debug(
"(" + self.class_.__name__ +
"|" +
- (self.local_table and self.local_table.description or str(self.local_table)) +
- (self.non_primary and "|non-primary" or "") + ") " +
+ (self.local_table is not None and self.local_table.description or str(self.local_table)) +
+ (self.non_primary is not None and "|non-primary" or "") + ") " +
msg)
def __repr__(self):
Comments (4)
-
Account Deleted -
repo owner non_primary is in fact a boolean so that should be left as it was before. the local_table is not None part is correct.
-
repo owner - changed status to resolved
-
repo owner - removed milestone
Removing milestone: 0.6.0 (automated comment)
- Log in to comment
I think that patch is wrong because everything shows up with |non-primary. Still, it is preferable to having the application crash just because logging is turned on.