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
1=== modified file 'ibid/core.py'
2--- ibid/core.py 2009-03-01 14:29:51 +0000
3+++ ibid/core.py 2009-03-07 16:36:25 +0000
4@@ -21,6 +21,7 @@
5 processor.process(event)
6 except Exception:
7 self.log.exception(u"Exception occured in %s processor of %s plugin", processor.__class__.__name__, processor.name)
8+ event.exceptioned = True
9
10 print event
11
12
13=== modified file 'ibid/plugins/core.py'
14--- ibid/plugins/core.py 2009-03-02 09:21:35 +0000
15+++ ibid/plugins/core.py 2009-03-07 16:36:25 +0000
16@@ -115,12 +115,18 @@
17 class Complain(Processor):
18
19 priority = 950
20- complaints = Option('complaints', 'Complaint responses', (u'Huh?', u'Sorry...', u'?', u'Excuse me?', u'*blink*', u'What?'))
21- 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"))
22+ complaints = Option('complaints', 'Complaint responses',
23+ (u'Huh?', u'Sorry...', u'?', u'Excuse me?', u'*blink*', u'What?'))
24+ notauthed = Option('notauthed', 'Complaint responses for auth failures',
25+ (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"))
26+ exceptioned = Option('exceptioned', 'Complaint responses for exceptions in modules',
27+ (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"))
28
29 @handler
30 def complain(self, event):
31- if 'notauthed' in event:
32+ if 'exceptioned' in event:
33+ event.addresponse(choice(self.exceptioned))
34+ elif 'notauthed' in event:
35 event.addresponse(choice(self.notauthed))
36 else:
37 event.addresponse(choice(self.complaints))
38
39=== modified file 'ibid/plugins/test.py'
40--- ibid/plugins/test.py 2009-03-01 14:29:51 +0000
41+++ ibid/plugins/test.py 2009-03-07 16:36:25 +0000
42@@ -30,7 +30,6 @@
43
44 @match(r'^raise\s+exception$')
45 def handler(self, event):
46- event.addresponse("I'll except in a moment")
47 raise Exception("Ow, that hurt.")
48
49 # vi: set et sta sw=4 ts=4:
50
51=== modified file 'scripts/ibid-plugin'
52--- scripts/ibid-plugin 2009-03-02 07:31:43 +0000
53+++ scripts/ibid-plugin 2009-03-07 16:36:25 +0000
54@@ -77,6 +77,7 @@
55 processor.process(event)
56 except Exception:
57 log.exception(u"Exception occured in %s processor of %s plugin", processor.__class__.__name__, processor.name)
58+ event.exceptioned = True
59
60 for response in event.responses:
61 if isinstance(response, dict):

Subscribers

People subscribed via source and target branches