Merge lp:~stefanor/ibid/stripper-501336 into lp:~ibid-core/ibid/old-trunk-1.6

Proposed by Stefano Rivera
Status: Merged
Approved by: Jonathan Hitchcock
Approved revision: not available
Merged at revision: 813
Proposed branch: lp:~stefanor/ibid/stripper-501336
Merge into: lp:~ibid-core/ibid/old-trunk-1.6
Diff against target: 38 lines (+3/-4)
3 files modified
ibid/plugins/core.py (+1/-1)
ibid/plugins/factoid.py (+1/-1)
scripts/ibid-plugin (+1/-2)
To merge this branch: bzr merge lp:~stefanor/ibid/stripper-501336
Reviewer Review Type Date Requested Status
Jonathan Hitchcock Approve
Michael Gorven Approve
Review via email: mp+16646@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Gorven (mgorven) wrote :

> + pattern = re.compile(r'^\s*(.*?)[?!.\s]*$', re.DOTALL)

That will prevent bypassing of the stripper (for example, deleting a factoid
called "foo!" by saying "forget foo! !"). I'd prefer ^\s*(.*?)\s*[?!.]*\s*$
 review needs_fixing

review: Needs Fixing
lp:~stefanor/ibid/stripper-501336 updated
813. By Stefano Rivera

Less agressive stripping

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

> I'd prefer ^\s*(.*?)\s*[?!.]*\s*$

Fixed in r813

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

 review approve

review: Approve
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/plugins/core.py'
2--- ibid/plugins/core.py 2009-12-05 18:26:45 +0000
3+++ ibid/plugins/core.py 2009-12-29 18:01:14 +0000
4@@ -45,7 +45,7 @@
5 addressed = False
6 event_types = ('message', 'action', 'notice')
7
8- pattern = re.compile(r'^\s*(.*?)[?!.]*\s*$', re.DOTALL)
9+ pattern = re.compile(r'^\s*(.*?)\s*[?!.]*\s*$', re.DOTALL)
10
11 @handler
12 def handle_strip(self, event):
13
14=== modified file 'ibid/plugins/factoid.py'
15--- ibid/plugins/factoid.py 2009-12-22 09:48:56 +0000
16+++ ibid/plugins/factoid.py 2009-12-29 18:01:14 +0000
17@@ -27,7 +27,7 @@
18
19 def strip_name(unstripped):
20 "Apply to factoid names, as we use unstripped matches"
21- return re.match(r'^\s*(.*?)[?!.]*\s*$', unstripped, re.DOTALL).group(1)
22+ return re.match(r'^\s*(.*?)\s*[?!.]*\s*$', unstripped, re.DOTALL).group(1)
23
24 def escape_name(name):
25 "Turn a $arg factoid name to _%"
26
27=== modified file 'scripts/ibid-plugin'
28--- scripts/ibid-plugin 2009-12-21 12:43:58 +0000
29+++ scripts/ibid-plugin 2009-12-29 18:01:14 +0000
30@@ -118,8 +118,7 @@
31 event.channel = u"testchan"
32
33 try:
34- message = unicode(raw_input('Query: '), encoding)
35- event.message = {'raw': message, 'clean': message, 'stripped': message, 'deaddressed': message}
36+ event.message = unicode(raw_input('Query: '), encoding)
37 except (KeyboardInterrupt, EOFError):
38 break
39

Subscribers

People subscribed via source and target branches