Merge lp:~bradwhittington/ibid/translation into lp:~ibid-core/ibid/old-trunk-pack-0.92

Proposed by Brad Whittington
Status: Rejected
Rejected by: Stefano Rivera
Proposed branch: lp:~bradwhittington/ibid/translation
Merge into: lp:~ibid-core/ibid/old-trunk-pack-0.92
Diff against target: None lines
To merge this branch: bzr merge lp:~bradwhittington/ibid/translation
Reviewer Review Type Date Requested Status
Stefano Rivera Disapprove
Jonathan Hitchcock Abstain
Michael Gorven Needs Fixing
Review via email: mp+3962@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Brad Whittington (bradwhittington) wrote :

I have altered the addresponse code to take *args and run them against a template string (if handed one). If it fails for some reason it will fall back to the vanilla response it was handed, and discard the args.

I have touched all the plugins which user '%s' % arg format, and rewritten where possible. Some of the modules do some funky logic, and their flow would have to be changed to be fully translatable.

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

I think we decided to use dicts so that translations can reorder the
arguments.
 review needs_fixing

review: Needs Fixing
Revision history for this message
Jonathan Hitchcock (vhata) wrote :

I don't understand the issues involved with this stuff enough to vote properly.

I will say that this seems to be a fairly deep architectural change that doesn't seem necessary right now?

review: Abstain
Revision history for this message
Russell Cloran (russell) wrote :

It'd be good if you could dig up the argument/case for not mixing args and
kwargs -- I have something like that at the back of my mind too, but can't
for the life of me remember where I would've seen it.

I think that kwargs would be much nicer than passing in a dict.

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

The only concern with the kwargs route is that we can't add any other parameters to addresponse().

Revision history for this message
Russell Cloran (russell) wrote :

Fair argument which I'd be happy to accept ;)

Revision history for this message
Brad Whittington (bradwhittington) wrote :

Will refactor to dict approach tomorrow, seems fine enough to me.

On 3/1/09, Russell Cloran <email address hidden> wrote:
> Fair argument which I'd be happy to accept ;)
>
> --
> https://code.launchpad.net/~bradwhittington/ibid/translation/+merge/3962
> You are subscribed to branch lp:~bradwhittington/ibid/translation.
>

--
Sent from my mobile device

Brad Whittington

--
The opinions reflected in this communication do not necessarily
reflect the opinions of Google.

http://whijo.net

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

"Will refactor to dict approach tomorrow, seems fine enough to me.

Be advised that I have a big pile of waiting merges on plugin contents.

The most problematic will be:
https://code.edge.launchpad.net/~stefanor/ibid/misc/+merge/4051

I'll attempt to prod Vhata and cocooncrash into skipping work and reading them.

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

"Be advised that I have a big pile of waiting merges on plugin contents."

Coast is clear again

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

Sorry, I redid this myself :P

review: Disapprove

Unmerged revisions

550. By Bradley Whittington <email address hidden>

Alters addresponse to take responses in the format (template_string, argument, argument, argument), starts adding better support for future translations. Relates to lp:334764

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ibid/event.py'
2--- ibid/event.py 2009-02-23 20:29:44 +0000
3+++ ibid/event.py 2009-02-26 09:53:00 +0000
4@@ -14,8 +14,12 @@
5 def __setattr__(self, name, value):
6 self[name] = value
7
8- def addresponse(self, response, processed=True):
9- self.responses.append(response)
10+ def addresponse(self, response, processed=True, *args):
11+ try:
12+ processed_response = response % args
13+ except TypeError:
14+ processed_response = response
15+ self.responses.append(processed_response)
16
17 if processed:
18 self.processed = True
19
20=== modified file 'ibid/plugins/admin.py'
21--- ibid/plugins/admin.py 2009-02-13 21:19:45 +0000
22+++ ibid/plugins/admin.py 2009-02-26 09:53:00 +0000
23@@ -36,7 +36,7 @@
24 else:
25 result = getattr(ibid.reloader, 'reload_%s' % module)()
26
27- event.addresponse(result and u'%s reloaded' % module or u"Couldn't reload %s" % module)
28+ event.addresponse(result and u'%s reloaded' or u"Couldn't reload %s", module)
29
30 class LoadModules(Processor):
31 """(load|unload|reload) <plugin|processor>"""
32@@ -49,13 +49,13 @@
33 def load(self, event, plugin):
34 result = ibid.reloader.unload_processor(plugin)
35 result = ibid.reloader.load_processor(plugin)
36- event.addresponse(result and u'%s reloaded' % plugin or u"Couldn't reload %s" % plugin)
37+ event.addresponse(result and u'%s reloaded' or u"Couldn't reload %s", plugin)
38
39 @match(r'^unload\s+(\S+)$')
40 @authorise
41 def unload(self, event, plugin):
42 result = ibid.reloader.unload_processor(plugin)
43- event.addresponse(result and u'%s unloaded' % plugin or u"Couldn't unload %s" % plugin)
44+ event.addresponse(result and u'%s unloaded' or u"Couldn't unload %s", plugin)
45
46 help['die'] = u'Terminates the bot'
47 class Die(Processor):
48
49=== modified file 'ibid/plugins/auth.py'
50--- ibid/plugins/auth.py 2009-02-22 15:30:46 +0000
51+++ ibid/plugins/auth.py 2009-02-26 09:53:00 +0000
52@@ -36,7 +36,7 @@
53 return
54 account = session.query(Account).filter_by(username=user).first()
55 if not account:
56- event.addresponse(u"I don't know who %s is" % user)
57+ event.addresponse(u"I don't know who %s is", user)
58 session.close()
59 return
60
61@@ -71,7 +71,7 @@
62 session = ibid.databases.ibid()
63 account = session.query(Account).filter_by(username=username).first()
64 if not account:
65- event.addresponse(u"I don't know who %s is" % username)
66+ event.addresponse(u"I don't know who %s is", username)
67 session.close()
68 return
69
70@@ -80,7 +80,7 @@
71 if permission:
72 session.delete(permission)
73 else:
74- event.addresponse(u"%s doesn't have that permission anyway" % username)
75+ event.addresponse(u"%s doesn't have that permission anyway", username)
76 return
77
78 else:
79@@ -95,7 +95,7 @@
80 value = 'yes'
81
82 if permission.value == value:
83- event.addresponse(u"%s permission for %s is already %s" % (name, username, value))
84+ event.addresponse(u"%s permission for %s is already %s", name, username, value)
85 return
86
87 permission.value = value
88@@ -120,7 +120,7 @@
89 return
90 account = session.query(Account).filter_by(username=username).first()
91 if not account:
92- event.addresponse(u"I don't know who %s is" % username)
93+ event.addresponse(u"I don't know who %s is", username)
94 return
95
96 event.addresponse(', '.join(['%s%s' % (permission_values[perm.value], perm.name) for perm in account.permissions]))
97
98=== modified file 'ibid/plugins/basic.py'
99--- ibid/plugins/basic.py 2009-02-13 21:19:45 +0000
100+++ ibid/plugins/basic.py 2009-02-26 09:53:00 +0000
101@@ -65,7 +65,7 @@
102
103 @match(r'^(?:choose|choice|pick)\s+(.+)$')
104 def choose(self, event, choices):
105- event.addresponse(u'I choose %s' % choice(choose_re.split(choices)))
106+ event.addresponse(u'I choose %s',choice(choose_re.split(choices)))
107
108 class UnicodeWarning(Processor):
109
110
111=== modified file 'ibid/plugins/crypto.py'
112--- ibid/plugins/crypto.py 2009-01-24 12:39:04 +0000
113+++ ibid/plugins/crypto.py 2009-02-26 09:53:00 +0000
114@@ -13,7 +13,7 @@
115
116 @match(r'^(md5|sha1|sha224|sha256|sha384|sha512)\s+(.+?)$')
117 def hash(self, event, hash, string):
118- event.addresponse(eval('hashlib.%s' % hash.lower())(string).hexdigest())
119+ event.addresponse(eval('hashlib.%s', hash.lower())(string).hexdigest())
120
121 @match(r'^crypt\s+(.+)\s+(\S+)$')
122 def handle_crypt(self, event, string, salt):
123
124=== modified file 'ibid/plugins/factoid.py'
125--- ibid/plugins/factoid.py 2009-02-23 20:29:44 +0000
126+++ ibid/plugins/factoid.py 2009-02-26 09:53:00 +0000
127@@ -149,7 +149,7 @@
128 session.close()
129 event.addresponse(True)
130 else:
131- event.addresponse(u"I didn't know about %s anyway" % name)
132+ event.addresponse(u"I didn't know about %s anyway", name)
133
134 @match(r'^(.+)\s+is\s+the\s+same\s+as\s+(.+)$')
135 @authorise
136@@ -169,7 +169,7 @@
137 event.addresponse(True)
138 log.info(u"Added name '%s' to factoid %s by %s/%s (%s)", name.name, factoid.id, event.account, event.identity, event.sender['connection'])
139 else:
140- event.addresponse(u"I don't know about %s" % name)
141+ event.addresponse(u"I don't know about %s", name)
142
143 class Search(Processor):
144 """(search|scan) for <pattern>"""
145@@ -292,7 +292,7 @@
146 session.delete(fvalue)
147 session.flush()
148 elif not addition:
149- event.addresponse(u"I already know stuff about %s" % name)
150+ event.addresponse(u"I already know stuff about %s", name)
151 return
152 else:
153 factoid = Factoid()
154
155=== modified file 'ibid/plugins/feeds.py'
156--- ibid/plugins/feeds.py 2009-02-23 20:29:44 +0000
157+++ ibid/plugins/feeds.py 2009-02-26 09:53:00 +0000
158@@ -58,7 +58,7 @@
159 feed = session.query(Feed).filter(func.lower(Feed.name)==name.lower()).first()
160
161 if feed:
162- event.addresponse(u"I already have the %s feed" % name)
163+ event.addresponse(u"I already have the %s feed", name)
164 else:
165 feed = Feed(unicode(name), unicode(url), event.identity)
166
167@@ -68,7 +68,7 @@
168 event.addresponse(True)
169 log.info(u"Added feed '%s' by %s/%s (%s): %s (Found %s entries)", name, event.account, event.identity, event.sender['connection'], url, len(feed.entries))
170 else:
171- event.addresponse(u"Sorry, I could not add the %s feed. %s is not a valid feed" % (name,url))
172+ event.addresponse(u"Sorry, I could not add the %s feed. %s is not a valid feed", name,url)
173
174 session.close()
175
176@@ -88,7 +88,7 @@
177 feed = session.query(Feed).filter(func.lower(Feed.name)==name.lower()).first()
178
179 if not feed:
180- event.addresponse(u"I don't have the %s feed anyway" % name)
181+ event.addresponse(u"I don't have the %s feed anyway", name)
182 else:
183 session.delete(feed)
184 log.info(u"Deleted feed '%s' by %s/%s (%s): %s", name, event.account, event.identity, event.sender['connection'], feed.url)
185@@ -112,7 +112,7 @@
186 session.close()
187
188 if not feed:
189- event.addresponse(u"I don't know about the %s feed" % name)
190+ event.addresponse(u"I don't know about the %s feed", name)
191 return
192
193 feed.update()
194@@ -129,7 +129,7 @@
195 session.close()
196
197 if not feed:
198- event.addresponse(u"I don't know about the %s feed" % name)
199+ event.addresponse(u"I don't know about the %s feed", name)
200 return
201
202 feed.update()
203@@ -163,6 +163,6 @@
204 else:
205 summary = article.content[0].value
206
207- event.addresponse(u'"%s" %s : %s' % (html2text_file(article.title, None).strip(), article.link, summary))
208+ event.addresponse(u'"%s" %s : %s', html2text_file(article.title, None).strip(), article.link, summary)
209
210 # vi: set et sta sw=4 ts=4:
211
212=== modified file 'ibid/plugins/google.py'
213--- ibid/plugins/google.py 2009-02-12 20:58:39 +0000
214+++ ibid/plugins/google.py 2009-02-26 09:53:00 +0000
215@@ -101,6 +101,6 @@
216 def compare(self, event, term1, term2):
217 count1 = self.results(term1)
218 count2 = self.results(term2)
219- event.addresponse(u'%s wins with %s hits, %s had %s hits' % (count1 > count2 and term1 or term2, count1 > count2 and count1 or count2, count1 > count2 and term2 or term1, count1 > count2 and count2 or count1))
220+ event.addresponse(u'%s wins with %s hits, %s had %s hits', count1 > count2 and term1 or term2, count1 > count2 and count1 or count2, count1 > count2 and term2 or term1, count1 > count2 and count2 or count1)
221
222 # vi: set et sta sw=4 ts=4:
223
224=== modified file 'ibid/plugins/help.py'
225--- ibid/plugins/help.py 2009-02-21 12:31:38 +0000
226+++ ibid/plugins/help.py 2009-02-26 09:53:00 +0000
227@@ -36,7 +36,7 @@
228 event.addresponse(module.help[feature])
229 return
230
231- event.addresponse(u"I can't help you with %s" % feature)
232+ event.addresponse(u"I can't help you with %s", feature)
233
234 @match(r'^(?:usage|how\s+do\s+I\s+use)\s+(.+)$')
235 def usage(self, event, feature):
236@@ -46,7 +46,7 @@
237 for name, klass in inspect.getmembers(processor, inspect.isclass):
238 if hasattr(klass, 'feature') and klass.feature == feature and klass.__doc__:
239 for line in klass.__doc__.splitlines():
240- event.addresponse('Usage: %s' % line.strip())
241+ event.addresponse('Usage: %s', line.strip())
242
243 if not event.responses:
244- event.addresponse(u"I don't know how to use %s either" % feature)
245+ event.addresponse(u"I don't know how to use %s either", feature)
246
247=== modified file 'ibid/plugins/identity.py'
248--- ibid/plugins/identity.py 2009-02-23 20:43:40 +0000
249+++ ibid/plugins/identity.py 2009-02-26 09:53:00 +0000
250@@ -29,12 +29,12 @@
251 admin = True
252 else:
253 account = session.query(Account).filter_by(id=event.account).first()
254- event.addresponse(u'You already have an account called "%s".' % account.username)
255+ event.addresponse(u'You already have an account called "%s".',account.username)
256 return
257
258 account = session.query(Account).filter_by(username=username).first()
259 if account:
260- event.addresponse(u'There is already an account called "%s". Please choose a different name.' % account.username)
261+ event.addresponse(u'There is already an account called "%s". Please choose a different name.', account.username)
262 return
263
264 account = Account(username)
265@@ -78,7 +78,7 @@
266 username = event.sender['id']
267 account = session.query(Account).filter_by(username=username).first()
268 if account:
269- event.addresponse(u"I tried to create the account %s for you, but it already exists. Please use 'create account <name>'." % username)
270+ event.addresponse(u"I tried to create the account %s for you, but it already exists. Please use 'create account <name>'.", username)
271 return
272 account = Account(username)
273 session.save_or_update(account)
274@@ -88,7 +88,7 @@
275 session.save_or_update(currentidentity)
276 session.flush()
277 identify_cache.clear()
278- event.addresponse(u"I've created the account %s for you" % username)
279+ event.addresponse(u"I've created the account %s for you", username)
280 log.info(u"Created account %s (%s) by %s/%s (%s)", account.id, account.username, event.account, event.identity, event.sender['connection'])
281 log.info(u"Attached identity %s (%s on %s) to account %s (%s)", currentidentity.id, currentidentity.identity, currentidentity.source, account.id, account.username)
282
283@@ -98,16 +98,16 @@
284 admin = True
285 account = session.query(Account).filter_by(username=username).first()
286 if not account:
287- event.addresponse(u"I don't know who %s is" % username)
288+ event.addresponse(u"I don't know who %s is", username)
289 return
290
291 ident = session.query(Identity).filter(func.lower(Identity.identity)==identity.lower()).filter(func.lower(Identity.source)==source.lower()).first()
292 if ident and ident.account:
293- event.addresponse(u'This identity is already attached to account %s' % ident.account.username)
294+ event.addresponse(u'This identity is already attached to account %s', ident.account.username)
295 return
296
297 if source.lower() not in ibid.sources:
298- event.addresponse(u"I am not connected to %s" % source)
299+ event.addresponse(u"I am not connected to %s", source)
300 else:
301 source = ibid.sources[source.lower()].name
302
303@@ -136,7 +136,7 @@
304 session = ibid.databases.ibid()
305 (account_id, user, source) = self.tokens[token]
306 if event.source.lower() != source.lower() or event.sender['id'].lower() != user.lower():
307- event.addresponse(u'You need to send me this token from %s on %s' % (user, source))
308+ event.addresponse(u'You need to send me this token from %s on %s', user, source)
309 return
310
311 identity = session.query(Identity).filter(func.lower(Identity.identity)==user.lower()).filter(func.lower(Identity.source)==source.lower()).first()
312@@ -163,7 +163,7 @@
313 return
314 account = session.query(Account).filter_by(username=username).first()
315 if not account:
316- event.addresponse(u"I don't know who %s is" % username)
317+ event.addresponse(u"I don't know who %s is", username)
318 return
319
320 identity = session.query(Identity).filter_by(account_id=account.id).filter(func.lower(Identity.identity)==user.lower()).filter(func.lower(Identity.source)==source.lower()).first()
321@@ -194,7 +194,7 @@
322 return
323 account = session.query(Account).filter_by(id=event.account).first()
324 if not account:
325- event.addresponse(u"%s doesn't exist. Please use 'add account' first" % username)
326+ event.addresponse(u"%s doesn't exist. Please use 'add account' first", username)
327 return
328
329 else:
330@@ -202,7 +202,7 @@
331 return
332 account = session.query(Account).filter_by(username=username).first()
333 if not account:
334- event.addresponse(u"I don't know who %s is" % username)
335+ event.addresponse(u"I don't know who %s is", username)
336 return
337
338 account.attributes.append(Attribute(name, value))
339@@ -220,17 +220,17 @@
340 if username.upper() == 'I':
341 if not event.account:
342 identity = session.query(Identity).get(event.identity)
343- event.addresponse(u"%s on %s" % (identity.identity, identity.source))
344+ event.addresponse(u"%s on %s", identity.identity, identity.source)
345 return
346 account = session.query(Account).get(event.account)
347
348 else:
349 account = session.query(Account).filter_by(username=username).first()
350 if not account:
351- event.addresponse(u"I don't know who %s is" % username)
352+ event.addresponse(u"I don't know who %s is", username)
353 return
354
355- event.addresponse(u'%s is %s' % (account.username, ', '.join('%s on %s' % (identity.identity, identity.source) for identity in account.identities)))
356+ event.addresponse(u'%s is %s', account.username, ', '.join('%s on %s' % (identity.identity, identity.source) for identity in account.identities))
357 session.close()
358
359 class Identify(Processor):
360
361=== modified file 'ibid/plugins/imdb.py'
362--- ibid/plugins/imdb.py 2009-02-23 14:59:37 +0000
363+++ ibid/plugins/imdb.py 2009-02-26 09:53:00 +0000
364@@ -48,7 +48,7 @@
365 self.imdb.update(result)
366
367 except IMDbDataAccessError, e:
368- event.addresponse(u"IMDb doesn't like me today. It said '%s'" % e[0]["errmsg"])
369+ event.addresponse(u"IMDb doesn't like me today. It said '%s'", e[0]["errmsg"])
370 raise
371
372 except IMDbError, e:
373@@ -56,7 +56,7 @@
374 raise
375
376 if result is not None:
377- event.addresponse(u"Found " + getattr(self, "display_" + search_type)(result))
378+ event.addresponse(u"Found %s", getattr(self, "display_" + search_type)(result))
379 return
380
381 if len(results) == 0:
382@@ -66,7 +66,7 @@
383 results = enumerate(results)
384 results = [u"%i: %s" % (x[0] + 1, x[1]) for x in results]
385 more = (u"", u">")[len(results) == 20]
386- event.addresponse(u"Found %s%i matches: %s" % (more, len(results), u", ".join(results)))
387+ event.addresponse(u"Found %s%i matches: %s", more, len(results), u", ".join(results))
388
389 def display_character(self, character):
390 desc = u"%s: %s." % (character.characterID, character["long imdb name"])
391
392=== modified file 'ibid/plugins/info.py'
393--- ibid/plugins/info.py 2009-02-23 20:29:44 +0000
394+++ ibid/plugins/info.py 2009-02-26 09:53:00 +0000
395@@ -41,7 +41,7 @@
396 def handle_nickometer(self, event, nick, wreasons):
397 nick = nick or event.sender['nick']
398 score, reasons = nickometer(str(nick))
399- event.addresponse(u"%s is %s%% lame" % (nick, score))
400+ event.addresponse(u"%s is %s%% lame", nick, score)
401 if wreasons:
402 event.addresponse(u', '.join(['%s (%s)' % reason for reason in reasons]))
403
404
405=== modified file 'ibid/plugins/irc.py'
406--- ibid/plugins/irc.py 2009-02-12 19:59:13 +0000
407+++ ibid/plugins/irc.py 2009-02-26 09:53:00 +0000
408@@ -27,15 +27,15 @@
409 source = ibid.sources[source.lower()]
410
411 if not hasattr(source, 'join'):
412- event.addresponse(u"%s cannot join/part channels" % (source.name,))
413+ event.addresponse(u"%s cannot join/part channels", source.name)
414 return
415
416 if action == 'join':
417 source.join(channel)
418- event.addresponse(u"Joining %s" % channel)
419+ event.addresponse(u"Joining %s", channel)
420 else:
421 source.part(channel)
422- event.addresponse(u"Parting %s" % channel)
423+ event.addresponse(u"Parting %s", channel)
424
425 @match(r'^change\s+nick\s+to\s+(\S+)(?:\s+on\s+(\S+))?$')
426 @authorise
427@@ -46,9 +46,9 @@
428 source = ibid.sources[source.lower()]
429
430 if not hasattr(source, 'change_nick'):
431- event.addresponse(u"%s cannot change nicks" % source)
432+ event.addresponse(u"%s cannot change nicks", source)
433 else:
434 source.change_nick(nick)
435- event.addresponse(u'Changing nick to %s' % nick)
436+ event.addresponse(u'Changing nick to %s', nick)
437
438 # vi: set et sta sw=4 ts=4:
439
440=== modified file 'ibid/plugins/karma.py'
441--- ibid/plugins/karma.py 2009-02-23 20:29:44 +0000
442+++ ibid/plugins/karma.py 2009-02-26 09:53:00 +0000
443@@ -94,9 +94,9 @@
444 session = ibid.databases.ibid()
445 karma = session.query(Karma).filter(func.lower(Karma.subject)==subject.lower()).first()
446 if not karma:
447- event.addresponse(u"%s has neutral karma" % subject)
448+ event.addresponse(u"%s has neutral karma",subject)
449 else:
450- event.addresponse(u"%s has karma of %s" % (subject, karma.value))
451+ event.addresponse(u"%s has karma of %s", subject, karma.value)
452 session.close()
453
454 @match(r'^(reverse\s+)?karmaladder$')
455
456=== modified file 'ibid/plugins/lookup.py'
457--- ibid/plugins/lookup.py 2009-02-22 10:37:32 +0000
458+++ ibid/plugins/lookup.py 2009-02-26 09:53:00 +0000
459@@ -243,9 +243,9 @@
460 def weather(self, event, place):
461 try:
462 values = self.remote_weather(place)
463- event.addresponse(u'In %(place)s at %(time)s: %(temp)s; Humidity: %(humidity)s; Wind: %(wind)s; Conditions: %(conditions)s; Sunrise/set: %(sunrise)s/%(sunset)s; Moonrise/set: %(moonrise)s/%(moonset)s' % values)
464+ event.addresponse(u'In %(place)s at %(time)s: %(temp)s; Humidity: %(humidity)s; Wind: %(wind)s; Conditions: %(conditions)s; Sunrise/set: %(sunrise)s/%(sunset)s; Moonrise/set: %(moonrise)s/%(moonset)s', values)
465 except Weather.TooManyPlacesException, e:
466- event.addresponse(u'Too many places match %s: %s' % (place, '; '.join(e.message)))
467+ event.addresponse(u'Too many places match %s: %s', place, '; '.join(e.message))
468 except Weather.WeatherException, e:
469 event.addresponse(e.message)
470
471@@ -254,7 +254,7 @@
472 try:
473 event.addresponse(u', '.join(self.remote_forecast(place)))
474 except Weather.TooManyPlacesException, e:
475- event.addresponse(u'Too many places match %s: %s' % (place, '; '.join(e.message)))
476+ event.addresponse(u'Too many places match %s: %s', place, '; '.join(e.message))
477 except Weather.WeatherException, e:
478 event.addresponse(e.message)
479
480
481=== modified file 'ibid/plugins/memo.py'
482--- ibid/plugins/memo.py 2009-02-23 20:29:44 +0000
483+++ ibid/plugins/memo.py 2009-02-26 09:53:00 +0000
484@@ -60,11 +60,11 @@
485 if not identity:
486 identity = account.identities[0]
487 if not to:
488- event.addresponse(u"I don't know who %s is" % who)
489+ event.addresponse(u"I don't know who %s is", who)
490 return
491
492 if permission(u'recvmemo', to.account and to.account.id or None, to.source) != 'yes':
493- event.addresponse(u'Just tell %s yourself' % who)
494+ event.addresponse(u'Just tell %s yourself', who)
495 return
496
497 memo = Memo(event.identity, to.id, memo, how.lower() in ('pm', 'privmsg', 'msg'))
498@@ -153,7 +153,7 @@
499 session = ibid.databases.ibid()
500 memos = get_memos(session, event, True)
501 memo = memos[int(number)]
502- event.addresponse(u"From %s on %s at %s: %s" % (memo.sender.identity, memo.sender.source, memo.time.strftime(self.datetime_format), memo.memo))
503+ event.addresponse(u"From %s on %s at %s: %s", memo.sender.identity, memo.sender.source, memo.time.strftime(self.datetime_format), memo.memo)
504 session.close()
505
506
507
508=== modified file 'ibid/plugins/misc.py'
509--- ibid/plugins/misc.py 2009-02-23 20:29:44 +0000
510+++ ibid/plugins/misc.py 2009-02-26 09:53:00 +0000
511@@ -26,7 +26,7 @@
512
513 self.pot = [event.sender['nick']]
514 sleep(self.time)
515- event.addresponse(u"Coffee's ready for %s!" % u', '.join(self.pot))
516+ event.addresponse(u"Coffee's ready for %s!", u', '.join(self.pot))
517 self.pot = None
518 return event
519
520@@ -53,7 +53,7 @@
521
522 @match(r'^version$')
523 def show_version(self, event):
524- event.addresponse(version and u"I am version %s" % version or u"I don't know what version I am :-(")
525+ event.addresponse(version and u"I am version %s" or u"I don't know what version I am :-(", version)
526
527 help['dvorak'] = u"Makes text typed on a QWERTY keyboard as if it was Dvorak work, and vice-versa"
528 class Dvorak(Processor):
529
530=== modified file 'ibid/plugins/network.py'
531--- ibid/plugins/network.py 2009-02-03 18:03:49 +0000
532+++ ibid/plugins/network.py 2009-02-26 09:53:00 +0000
533@@ -34,10 +34,10 @@
534 try:
535 answers = resolver.query(host, str(record))
536 except NoAnswer:
537- event.addresponse(u"I couldn't find any %s records for %s" % (record, host))
538+ event.addresponse(u"I couldn't find any %s records for %s", record, host)
539 return
540 except NXDOMAIN:
541- event.addresponse(u"I couldn't find the domain %s" % host)
542+ event.addresponse(u"I couldn't find the domain %s", host)
543 return
544
545 responses = []
546
547=== modified file 'ibid/plugins/seen.py'
548--- ibid/plugins/seen.py 2009-02-18 19:05:10 +0000
549+++ ibid/plugins/seen.py 2009-02-26 09:53:00 +0000
550@@ -82,7 +82,7 @@
551 account = session.query(Account).filter_by(username=who).first()
552
553 if not identity and not account:
554- event.addresponse(u"I don't know who %s is" % who)
555+ event.addresponse(u"I don't know who %s is", who)
556 return
557
558 messages = []
559@@ -102,7 +102,7 @@
560 states.append(sighting)
561
562 if len(messages) == 0 and len(states) == 0:
563- event.addresponse(u"I haven't seen %s" % who)
564+ event.addresponse(u"I haven't seen %s", who)
565 return
566
567 messages.sort(key=lambda x: x.time, reverse=True)
568
569=== modified file 'ibid/plugins/sources.py'
570--- ibid/plugins/sources.py 2009-02-17 21:04:17 +0000
571+++ ibid/plugins/sources.py 2009-02-26 09:53:00 +0000
572@@ -15,26 +15,26 @@
573 def connect(self, event, source):
574
575 if ibid.sources[source.lower()].connect():
576- event.addresponse(u'Connecting to %s' % source)
577+ event.addresponse(u'Connecting to %s', source)
578 else:
579- event.addresponse(u"I couldn't connect to %s" % source)
580+ event.addresponse(u"I couldn't connect to %s", source)
581
582 @match(r'^disconnect\s+(?:from\s+)?(\S+)$')
583 @authorise
584 def disconnect(self, event, source):
585
586 if ibid.sources[source.lower()].disconnect():
587- event.addresponse(u'Disconnecting from %s' % source)
588+ event.addresponse(u'Disconnecting from %s', source)
589 else:
590- event.addresponse(u"I couldn't disconnect from %s" % source)
591+ event.addresponse(u"I couldn't disconnect from %s", source)
592
593 @match(r'^(?:re)?load\s+(\S+)\s+source$')
594 @authorise
595 def load(self, event, source):
596 if ibid.reloader.load_source(source, ibid.service):
597- event.addresponse(u"%s source loaded" % source)
598+ event.addresponse(u"%s source loaded", source)
599 else:
600- event.addresponse(u"Couldn't load %s source" % source)
601+ event.addresponse(u"Couldn't load %s source", source)
602
603 class Info(Processor):
604 """(sources|list configured sources)"""
605
606=== modified file 'ibid/plugins/test.py'
607--- ibid/plugins/test.py 2009-01-12 17:35:59 +0000
608+++ ibid/plugins/test.py 2009-02-26 09:53:00 +0000
609@@ -25,6 +25,6 @@
610 @match(r'^email\s+(.+)$')
611 def email(self, event, address):
612 event.addresponse({'reply': 'Test message', 'source': 'email', 'target': unicode(address)})
613- event.addresponse(u"I've emailed %s" % address)
614+ event.addresponse(u"I've emailed %s", address)
615
616 # vi: set et sta sw=4 ts=4:

Subscribers

People subscribed via source and target branches