Merge lp:~stefanor/ibid/plugin-exception-333174 into lp:~ibid-core/ibid/old-trunk-pack-0.92

Proposed by Stefano Rivera
Status: Merged
Approved by: Stefano Rivera
Approved revision: 566
Merged at revision: 568
Proposed branch: lp:~stefanor/ibid/plugin-exception-333174
Merge into: lp:~ibid-core/ibid/old-trunk-pack-0.92
Diff against target: None lines
To merge this branch: bzr merge lp:~stefanor/ibid/plugin-exception-333174
Reviewer Review Type Date Requested Status
Jonathan Hitchcock Approve
Michael Gorven Approve
Review via email: mp+4269@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stefano Rivera (stefanor) wrote :

Thoughts?

Revision history for this message
Michael Gorven (mgorven) wrote :

Design looks fine. Vhata suggested using quotes from HAL 2000. Maybe we should
move 'exceptioned' and 'notauthed' into a single attribute though
(event.complaint='exception/auth') and make Complain a bit more generic.

Revision history for this message
Stefano Rivera (stefanor) wrote :

> Design looks fine. Vhata suggested using quotes from HAL 2000.

I can't find enough good quotes: http://www.imdb.com/character/ch0002900/quotes
Thoughts?

> Maybe we should move 'exceptioned' and 'notauthed' into a single attribute
> though (event.complaint='exception/auth') and make Complain a bit more
> generic.

Done.

563. By Stefano Rivera

More generic complaint framework

Revision history for this message
Michael Gorven (mgorven) wrote :

I'd use a single config option for all the complaints, so the config file would look something like:

[[[complaints]]]
notauthed = foo, bar
exception = baz, quaz

and in Complain:

choice(self.complaints[event.complain])

564. By Stefano Rivera

Complaints unified inside a configuration file sub-tree

Revision history for this message
Michael Gorven (mgorven) wrote :

Other than "nonsese", it looks good.

review: Approve
565. By Stefano Rivera

Spelling

566. By Stefano Rivera

Merge from trunk

Revision history for this message
Jonathan Hitchcock (vhata) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ibid/core.py'
--- ibid/core.py 2009-03-01 14:29:51 +0000
+++ ibid/core.py 2009-03-07 16:36:25 +0000
@@ -21,6 +21,7 @@
21 processor.process(event)21 processor.process(event)
22 except Exception:22 except Exception:
23 self.log.exception(u"Exception occured in %s processor of %s plugin", processor.__class__.__name__, processor.name)23 self.log.exception(u"Exception occured in %s processor of %s plugin", processor.__class__.__name__, processor.name)
24 event.exceptioned = True
2425
25 print event26 print event
2627
2728
=== modified file 'ibid/plugins/core.py'
--- ibid/plugins/core.py 2009-03-02 09:21:35 +0000
+++ ibid/plugins/core.py 2009-03-07 16:36:25 +0000
@@ -115,12 +115,18 @@
115class Complain(Processor):115class Complain(Processor):
116116
117 priority = 950117 priority = 950
118 complaints = Option('complaints', 'Complaint responses', (u'Huh?', u'Sorry...', u'?', u'Excuse me?', u'*blink*', u'What?'))118 complaints = Option('complaints', 'Complaint responses',
119 notauthed = Option('notauthed', 'Complaint responses for auth failures', (u"I'm not your bitch", u"Just do it yourself", u"I'm not going to listen to you", u"You're not the boss of me"))119 (u'Huh?', u'Sorry...', u'?', u'Excuse me?', u'*blink*', u'What?'))
120 notauthed = Option('notauthed', 'Complaint responses for auth failures',
121 (u"I'm not your bitch", u"Just do it yourself", u"I'm not going to listen to you", u"You're not the boss of me"))
122 exceptioned = Option('exceptioned', 'Complaint responses for exceptions in modules',
123 (u"I'm not feeling too well", u"That didn't go down very well. Burp.", u"That didn't seem to agree with me"))
120124
121 @handler125 @handler
122 def complain(self, event):126 def complain(self, event):
123 if 'notauthed' in event:127 if 'exceptioned' in event:
128 event.addresponse(choice(self.exceptioned))
129 elif 'notauthed' in event:
124 event.addresponse(choice(self.notauthed))130 event.addresponse(choice(self.notauthed))
125 else:131 else:
126 event.addresponse(choice(self.complaints))132 event.addresponse(choice(self.complaints))
127133
=== modified file 'ibid/plugins/test.py'
--- ibid/plugins/test.py 2009-03-01 14:29:51 +0000
+++ ibid/plugins/test.py 2009-03-07 16:36:25 +0000
@@ -30,7 +30,6 @@
3030
31 @match(r'^raise\s+exception$')31 @match(r'^raise\s+exception$')
32 def handler(self, event):32 def handler(self, event):
33 event.addresponse("I'll except in a moment")
34 raise Exception("Ow, that hurt.")33 raise Exception("Ow, that hurt.")
3534
36# vi: set et sta sw=4 ts=4:35# vi: set et sta sw=4 ts=4:
3736
=== modified file 'scripts/ibid-plugin'
--- scripts/ibid-plugin 2009-03-02 07:31:43 +0000
+++ scripts/ibid-plugin 2009-03-07 16:36:25 +0000
@@ -77,6 +77,7 @@
77 processor.process(event)77 processor.process(event)
78 except Exception:78 except Exception:
79 log.exception(u"Exception occured in %s processor of %s plugin", processor.__class__.__name__, processor.name)79 log.exception(u"Exception occured in %s processor of %s plugin", processor.__class__.__name__, processor.name)
80 event.exceptioned = True
8081
81 for response in event.responses:82 for response in event.responses:
82 if isinstance(response, dict):83 if isinstance(response, dict):

Subscribers

People subscribed via source and target branches