diff options
author | W. Trevor King <wking@tremily.us> | 2013-01-24 02:31:52 -0500 |
---|---|---|
committer | W. Trevor King <wking@tremily.us> | 2013-01-24 02:36:22 -0500 |
commit | 932679f1e82a57feb4743e52d6c60f7331f057c2 (patch) | |
tree | 21c014cf36c8c159b7e5bf4627abf94b2e7a371b /libbe/comment.py | |
parent | 182a556397c2b0f4638991942c736c5daff17111 (diff) | |
download | bugseverywhere-932679f1e82a57feb4743e52d6c60f7331f057c2.tar.gz |
Transition to libbe.LOG for logging
This makes it easier to tweak log verbosity and redirect logs to other
handlers. For example, the WSGI servers are unstable with stderr
closed, and crash with an IOError if they try to print a warning to
stderr.
Diffstat (limited to 'libbe/comment.py')
-rw-r--r-- | libbe/comment.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libbe/comment.py b/libbe/comment.py index a669e4e..9bef50a 100644 --- a/libbe/comment.py +++ b/libbe/comment.py @@ -333,7 +333,7 @@ class Comment (Tree, settings_object.SavedSettingsObject): sep = '\n' + istring return istring + sep.join(lines).rstrip('\n') - def from_xml(self, xml_string, preserve_uuids=False, verbose=True): + def from_xml(self, xml_string, preserve_uuids=False): u""" Note: If alt-id is not given, translates any <uuid> fields to <alt-id> fields. @@ -344,7 +344,7 @@ class Comment (Tree, settings_object.SavedSettingsObject): >>> commA.extra_strings += ['TAG: very helpful'] >>> xml = commA.xml() >>> commB = Comment() - >>> commB.from_xml(xml, verbose=True) + >>> commB.from_xml(xml) >>> commB.explicit_attrs ['author', 'date', 'content_type', 'body', 'alt_id'] >>> commB.xml() == xml @@ -397,9 +397,10 @@ class Comment (Tree, settings_object.SavedSettingsObject): attr_name = child.tag.replace('-','_') self.explicit_attrs.append(attr_name) setattr(self, attr_name, text) - elif verbose == True: - print >> sys.stderr, 'Ignoring unknown tag %s in %s' \ - % (child.tag, comment.tag) + else: + libbe.LOG.warning( + 'ignoring unknown tag {0} in {1}'.format( + child.tag, comment.tag)) if uuid != self.uuid and self.alt_id == None: self.explicit_attrs.append('alt_id') self.alt_id = uuid |