Merge lp:~nataliabidart/ubuntuone-dev-tools/check-exception into lp:ubuntuone-dev-tools

Proposed by Natalia Bidart
Status: Merged
Approved by: Rick McBride
Approved revision: 10
Merged at revision: 13
Proposed branch: lp:~nataliabidart/ubuntuone-dev-tools/check-exception
Merge into: lp:ubuntuone-dev-tools
Diff against target: 16 lines (+9/-0)
1 file modified
ubuntuone/devtools/handlers.py (+9/-0)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-dev-tools/check-exception
Reviewer Review Type Date Requested Status
Rick McBride (community) Approve
dobey (community) Approve
Review via email: mp+43292@code.launchpad.net

Commit message

Adding 'check_exception' for MementoHandler.

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

Looks good. Would like to get unit tests in for this stuff though. Could you file a bug for adding them please?

review: Approve
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Bug created at #688262

Revision history for this message
Rick McBride (rmcbride) wrote :

Great! Thanks for doing the bug for unit tests too.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/devtools/handlers.py'
2--- ubuntuone/devtools/handlers.py 2010-11-03 21:04:06 +0000
3+++ ubuntuone/devtools/handlers.py 2010-12-09 21:03:57 +0000
4@@ -62,3 +62,12 @@
5 def check_error(self, *msgs):
6 """Shortcut for checking in ERROR."""
7 return self.check(logging.ERROR, *msgs)
8+
9+ def check_exception(self, exception_class, *msgs):
10+ """Shortcut for checking exceptions."""
11+ for rec in self.records:
12+ if rec.levelno == logging.ERROR and \
13+ all(m in rec.exc_text for m in msgs) and \
14+ exception_class == rec.exc_info[0]:
15+ return True
16+ return False

Subscribers

People subscribed via source and target branches

to all changes: