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
=== modified file 'ibid/event.py'
--- ibid/event.py 2009-02-23 20:29:44 +0000
+++ ibid/event.py 2009-02-26 09:53:00 +0000
@@ -14,8 +14,12 @@
14 def __setattr__(self, name, value):14 def __setattr__(self, name, value):
15 self[name] = value15 self[name] = value
1616
17 def addresponse(self, response, processed=True):17 def addresponse(self, response, processed=True, *args):
18 self.responses.append(response)18 try:
19 processed_response = response % args
20 except TypeError:
21 processed_response = response
22 self.responses.append(processed_response)
1923
20 if processed:24 if processed:
21 self.processed = True25 self.processed = True
2226
=== modified file 'ibid/plugins/admin.py'
--- ibid/plugins/admin.py 2009-02-13 21:19:45 +0000
+++ ibid/plugins/admin.py 2009-02-26 09:53:00 +0000
@@ -36,7 +36,7 @@
36 else:36 else:
37 result = getattr(ibid.reloader, 'reload_%s' % module)()37 result = getattr(ibid.reloader, 'reload_%s' % module)()
3838
39 event.addresponse(result and u'%s reloaded' % module or u"Couldn't reload %s" % module)39 event.addresponse(result and u'%s reloaded' or u"Couldn't reload %s", module)
4040
41class LoadModules(Processor):41class LoadModules(Processor):
42 """(load|unload|reload) <plugin|processor>"""42 """(load|unload|reload) <plugin|processor>"""
@@ -49,13 +49,13 @@
49 def load(self, event, plugin):49 def load(self, event, plugin):
50 result = ibid.reloader.unload_processor(plugin)50 result = ibid.reloader.unload_processor(plugin)
51 result = ibid.reloader.load_processor(plugin)51 result = ibid.reloader.load_processor(plugin)
52 event.addresponse(result and u'%s reloaded' % plugin or u"Couldn't reload %s" % plugin)52 event.addresponse(result and u'%s reloaded' or u"Couldn't reload %s", plugin)
5353
54 @match(r'^unload\s+(\S+)$')54 @match(r'^unload\s+(\S+)$')
55 @authorise55 @authorise
56 def unload(self, event, plugin):56 def unload(self, event, plugin):
57 result = ibid.reloader.unload_processor(plugin)57 result = ibid.reloader.unload_processor(plugin)
58 event.addresponse(result and u'%s unloaded' % plugin or u"Couldn't unload %s" % plugin)58 event.addresponse(result and u'%s unloaded' or u"Couldn't unload %s", plugin)
5959
60help['die'] = u'Terminates the bot'60help['die'] = u'Terminates the bot'
61class Die(Processor):61class Die(Processor):
6262
=== modified file 'ibid/plugins/auth.py'
--- ibid/plugins/auth.py 2009-02-22 15:30:46 +0000
+++ ibid/plugins/auth.py 2009-02-26 09:53:00 +0000
@@ -36,7 +36,7 @@
36 return36 return
37 account = session.query(Account).filter_by(username=user).first()37 account = session.query(Account).filter_by(username=user).first()
38 if not account:38 if not account:
39 event.addresponse(u"I don't know who %s is" % user)39 event.addresponse(u"I don't know who %s is", user)
40 session.close()40 session.close()
41 return41 return
4242
@@ -71,7 +71,7 @@
71 session = ibid.databases.ibid()71 session = ibid.databases.ibid()
72 account = session.query(Account).filter_by(username=username).first()72 account = session.query(Account).filter_by(username=username).first()
73 if not account:73 if not account:
74 event.addresponse(u"I don't know who %s is" % username)74 event.addresponse(u"I don't know who %s is", username)
75 session.close()75 session.close()
76 return76 return
7777
@@ -80,7 +80,7 @@
80 if permission:80 if permission:
81 session.delete(permission)81 session.delete(permission)
82 else:82 else:
83 event.addresponse(u"%s doesn't have that permission anyway" % username)83 event.addresponse(u"%s doesn't have that permission anyway", username)
84 return84 return
8585
86 else:86 else:
@@ -95,7 +95,7 @@
95 value = 'yes'95 value = 'yes'
9696
97 if permission.value == value:97 if permission.value == value:
98 event.addresponse(u"%s permission for %s is already %s" % (name, username, value))98 event.addresponse(u"%s permission for %s is already %s", name, username, value)
99 return99 return
100100
101 permission.value = value101 permission.value = value
@@ -120,7 +120,7 @@
120 return120 return
121 account = session.query(Account).filter_by(username=username).first()121 account = session.query(Account).filter_by(username=username).first()
122 if not account:122 if not account:
123 event.addresponse(u"I don't know who %s is" % username)123 event.addresponse(u"I don't know who %s is", username)
124 return124 return
125125
126 event.addresponse(', '.join(['%s%s' % (permission_values[perm.value], perm.name) for perm in account.permissions]))126 event.addresponse(', '.join(['%s%s' % (permission_values[perm.value], perm.name) for perm in account.permissions]))
127127
=== modified file 'ibid/plugins/basic.py'
--- ibid/plugins/basic.py 2009-02-13 21:19:45 +0000
+++ ibid/plugins/basic.py 2009-02-26 09:53:00 +0000
@@ -65,7 +65,7 @@
6565
66 @match(r'^(?:choose|choice|pick)\s+(.+)$')66 @match(r'^(?:choose|choice|pick)\s+(.+)$')
67 def choose(self, event, choices):67 def choose(self, event, choices):
68 event.addresponse(u'I choose %s' % choice(choose_re.split(choices)))68 event.addresponse(u'I choose %s',choice(choose_re.split(choices)))
6969
70class UnicodeWarning(Processor):70class UnicodeWarning(Processor):
7171
7272
=== modified file 'ibid/plugins/crypto.py'
--- ibid/plugins/crypto.py 2009-01-24 12:39:04 +0000
+++ ibid/plugins/crypto.py 2009-02-26 09:53:00 +0000
@@ -13,7 +13,7 @@
1313
14 @match(r'^(md5|sha1|sha224|sha256|sha384|sha512)\s+(.+?)$')14 @match(r'^(md5|sha1|sha224|sha256|sha384|sha512)\s+(.+?)$')
15 def hash(self, event, hash, string):15 def hash(self, event, hash, string):
16 event.addresponse(eval('hashlib.%s' % hash.lower())(string).hexdigest())16 event.addresponse(eval('hashlib.%s', hash.lower())(string).hexdigest())
1717
18 @match(r'^crypt\s+(.+)\s+(\S+)$')18 @match(r'^crypt\s+(.+)\s+(\S+)$')
19 def handle_crypt(self, event, string, salt):19 def handle_crypt(self, event, string, salt):
2020
=== modified file 'ibid/plugins/factoid.py'
--- ibid/plugins/factoid.py 2009-02-23 20:29:44 +0000
+++ ibid/plugins/factoid.py 2009-02-26 09:53:00 +0000
@@ -149,7 +149,7 @@
149 session.close()149 session.close()
150 event.addresponse(True)150 event.addresponse(True)
151 else:151 else:
152 event.addresponse(u"I didn't know about %s anyway" % name)152 event.addresponse(u"I didn't know about %s anyway", name)
153153
154 @match(r'^(.+)\s+is\s+the\s+same\s+as\s+(.+)$')154 @match(r'^(.+)\s+is\s+the\s+same\s+as\s+(.+)$')
155 @authorise155 @authorise
@@ -169,7 +169,7 @@
169 event.addresponse(True)169 event.addresponse(True)
170 log.info(u"Added name '%s' to factoid %s by %s/%s (%s)", name.name, factoid.id, event.account, event.identity, event.sender['connection'])170 log.info(u"Added name '%s' to factoid %s by %s/%s (%s)", name.name, factoid.id, event.account, event.identity, event.sender['connection'])
171 else:171 else:
172 event.addresponse(u"I don't know about %s" % name)172 event.addresponse(u"I don't know about %s", name)
173173
174class Search(Processor):174class Search(Processor):
175 """(search|scan) for <pattern>"""175 """(search|scan) for <pattern>"""
@@ -292,7 +292,7 @@
292 session.delete(fvalue)292 session.delete(fvalue)
293 session.flush()293 session.flush()
294 elif not addition:294 elif not addition:
295 event.addresponse(u"I already know stuff about %s" % name)295 event.addresponse(u"I already know stuff about %s", name)
296 return296 return
297 else:297 else:
298 factoid = Factoid()298 factoid = Factoid()
299299
=== modified file 'ibid/plugins/feeds.py'
--- ibid/plugins/feeds.py 2009-02-23 20:29:44 +0000
+++ ibid/plugins/feeds.py 2009-02-26 09:53:00 +0000
@@ -58,7 +58,7 @@
58 feed = session.query(Feed).filter(func.lower(Feed.name)==name.lower()).first()58 feed = session.query(Feed).filter(func.lower(Feed.name)==name.lower()).first()
5959
60 if feed:60 if feed:
61 event.addresponse(u"I already have the %s feed" % name)61 event.addresponse(u"I already have the %s feed", name)
62 else:62 else:
63 feed = Feed(unicode(name), unicode(url), event.identity)63 feed = Feed(unicode(name), unicode(url), event.identity)
6464
@@ -68,7 +68,7 @@
68 event.addresponse(True)68 event.addresponse(True)
69 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))69 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))
70 else:70 else:
71 event.addresponse(u"Sorry, I could not add the %s feed. %s is not a valid feed" % (name,url))71 event.addresponse(u"Sorry, I could not add the %s feed. %s is not a valid feed", name,url)
7272
73 session.close()73 session.close()
7474
@@ -88,7 +88,7 @@
88 feed = session.query(Feed).filter(func.lower(Feed.name)==name.lower()).first()88 feed = session.query(Feed).filter(func.lower(Feed.name)==name.lower()).first()
8989
90 if not feed:90 if not feed:
91 event.addresponse(u"I don't have the %s feed anyway" % name)91 event.addresponse(u"I don't have the %s feed anyway", name)
92 else:92 else:
93 session.delete(feed)93 session.delete(feed)
94 log.info(u"Deleted feed '%s' by %s/%s (%s): %s", name, event.account, event.identity, event.sender['connection'], feed.url)94 log.info(u"Deleted feed '%s' by %s/%s (%s): %s", name, event.account, event.identity, event.sender['connection'], feed.url)
@@ -112,7 +112,7 @@
112 session.close()112 session.close()
113113
114 if not feed:114 if not feed:
115 event.addresponse(u"I don't know about the %s feed" % name)115 event.addresponse(u"I don't know about the %s feed", name)
116 return116 return
117117
118 feed.update()118 feed.update()
@@ -129,7 +129,7 @@
129 session.close()129 session.close()
130130
131 if not feed:131 if not feed:
132 event.addresponse(u"I don't know about the %s feed" % name)132 event.addresponse(u"I don't know about the %s feed", name)
133 return133 return
134134
135 feed.update() 135 feed.update()
@@ -163,6 +163,6 @@
163 else:163 else:
164 summary = article.content[0].value164 summary = article.content[0].value
165165
166 event.addresponse(u'"%s" %s : %s' % (html2text_file(article.title, None).strip(), article.link, summary))166 event.addresponse(u'"%s" %s : %s', html2text_file(article.title, None).strip(), article.link, summary)
167167
168# vi: set et sta sw=4 ts=4:168# vi: set et sta sw=4 ts=4:
169169
=== modified file 'ibid/plugins/google.py'
--- ibid/plugins/google.py 2009-02-12 20:58:39 +0000
+++ ibid/plugins/google.py 2009-02-26 09:53:00 +0000
@@ -101,6 +101,6 @@
101 def compare(self, event, term1, term2):101 def compare(self, event, term1, term2):
102 count1 = self.results(term1)102 count1 = self.results(term1)
103 count2 = self.results(term2)103 count2 = self.results(term2)
104 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))104 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)
105105
106# vi: set et sta sw=4 ts=4:106# vi: set et sta sw=4 ts=4:
107107
=== modified file 'ibid/plugins/help.py'
--- ibid/plugins/help.py 2009-02-21 12:31:38 +0000
+++ ibid/plugins/help.py 2009-02-26 09:53:00 +0000
@@ -36,7 +36,7 @@
36 event.addresponse(module.help[feature])36 event.addresponse(module.help[feature])
37 return37 return
3838
39 event.addresponse(u"I can't help you with %s" % feature)39 event.addresponse(u"I can't help you with %s", feature)
4040
41 @match(r'^(?:usage|how\s+do\s+I\s+use)\s+(.+)$')41 @match(r'^(?:usage|how\s+do\s+I\s+use)\s+(.+)$')
42 def usage(self, event, feature):42 def usage(self, event, feature):
@@ -46,7 +46,7 @@
46 for name, klass in inspect.getmembers(processor, inspect.isclass):46 for name, klass in inspect.getmembers(processor, inspect.isclass):
47 if hasattr(klass, 'feature') and klass.feature == feature and klass.__doc__:47 if hasattr(klass, 'feature') and klass.feature == feature and klass.__doc__:
48 for line in klass.__doc__.splitlines():48 for line in klass.__doc__.splitlines():
49 event.addresponse('Usage: %s' % line.strip())49 event.addresponse('Usage: %s', line.strip())
5050
51 if not event.responses:51 if not event.responses:
52 event.addresponse(u"I don't know how to use %s either" % feature)52 event.addresponse(u"I don't know how to use %s either", feature)
5353
=== modified file 'ibid/plugins/identity.py'
--- ibid/plugins/identity.py 2009-02-23 20:43:40 +0000
+++ ibid/plugins/identity.py 2009-02-26 09:53:00 +0000
@@ -29,12 +29,12 @@
29 admin = True29 admin = True
30 else:30 else:
31 account = session.query(Account).filter_by(id=event.account).first()31 account = session.query(Account).filter_by(id=event.account).first()
32 event.addresponse(u'You already have an account called "%s".' % account.username)32 event.addresponse(u'You already have an account called "%s".',account.username)
33 return33 return
3434
35 account = session.query(Account).filter_by(username=username).first()35 account = session.query(Account).filter_by(username=username).first()
36 if account:36 if account:
37 event.addresponse(u'There is already an account called "%s". Please choose a different name.' % account.username)37 event.addresponse(u'There is already an account called "%s". Please choose a different name.', account.username)
38 return38 return
3939
40 account = Account(username)40 account = Account(username)
@@ -78,7 +78,7 @@
78 username = event.sender['id']78 username = event.sender['id']
79 account = session.query(Account).filter_by(username=username).first()79 account = session.query(Account).filter_by(username=username).first()
80 if account:80 if account:
81 event.addresponse(u"I tried to create the account %s for you, but it already exists. Please use 'create account <name>'." % username)81 event.addresponse(u"I tried to create the account %s for you, but it already exists. Please use 'create account <name>'.", username)
82 return82 return
83 account = Account(username)83 account = Account(username)
84 session.save_or_update(account)84 session.save_or_update(account)
@@ -88,7 +88,7 @@
88 session.save_or_update(currentidentity)88 session.save_or_update(currentidentity)
89 session.flush()89 session.flush()
90 identify_cache.clear()90 identify_cache.clear()
91 event.addresponse(u"I've created the account %s for you" % username)91 event.addresponse(u"I've created the account %s for you", username)
92 log.info(u"Created account %s (%s) by %s/%s (%s)", account.id, account.username, event.account, event.identity, event.sender['connection'])92 log.info(u"Created account %s (%s) by %s/%s (%s)", account.id, account.username, event.account, event.identity, event.sender['connection'])
93 log.info(u"Attached identity %s (%s on %s) to account %s (%s)", currentidentity.id, currentidentity.identity, currentidentity.source, account.id, account.username)93 log.info(u"Attached identity %s (%s on %s) to account %s (%s)", currentidentity.id, currentidentity.identity, currentidentity.source, account.id, account.username)
9494
@@ -98,16 +98,16 @@
98 admin = True98 admin = True
99 account = session.query(Account).filter_by(username=username).first()99 account = session.query(Account).filter_by(username=username).first()
100 if not account:100 if not account:
101 event.addresponse(u"I don't know who %s is" % username)101 event.addresponse(u"I don't know who %s is", username)
102 return102 return
103103
104 ident = session.query(Identity).filter(func.lower(Identity.identity)==identity.lower()).filter(func.lower(Identity.source)==source.lower()).first()104 ident = session.query(Identity).filter(func.lower(Identity.identity)==identity.lower()).filter(func.lower(Identity.source)==source.lower()).first()
105 if ident and ident.account:105 if ident and ident.account:
106 event.addresponse(u'This identity is already attached to account %s' % ident.account.username)106 event.addresponse(u'This identity is already attached to account %s', ident.account.username)
107 return107 return
108108
109 if source.lower() not in ibid.sources:109 if source.lower() not in ibid.sources:
110 event.addresponse(u"I am not connected to %s" % source)110 event.addresponse(u"I am not connected to %s", source)
111 else:111 else:
112 source = ibid.sources[source.lower()].name112 source = ibid.sources[source.lower()].name
113113
@@ -136,7 +136,7 @@
136 session = ibid.databases.ibid()136 session = ibid.databases.ibid()
137 (account_id, user, source) = self.tokens[token]137 (account_id, user, source) = self.tokens[token]
138 if event.source.lower() != source.lower() or event.sender['id'].lower() != user.lower():138 if event.source.lower() != source.lower() or event.sender['id'].lower() != user.lower():
139 event.addresponse(u'You need to send me this token from %s on %s' % (user, source))139 event.addresponse(u'You need to send me this token from %s on %s', user, source)
140 return140 return
141141
142 identity = session.query(Identity).filter(func.lower(Identity.identity)==user.lower()).filter(func.lower(Identity.source)==source.lower()).first()142 identity = session.query(Identity).filter(func.lower(Identity.identity)==user.lower()).filter(func.lower(Identity.source)==source.lower()).first()
@@ -163,7 +163,7 @@
163 return163 return
164 account = session.query(Account).filter_by(username=username).first()164 account = session.query(Account).filter_by(username=username).first()
165 if not account:165 if not account:
166 event.addresponse(u"I don't know who %s is" % username)166 event.addresponse(u"I don't know who %s is", username)
167 return167 return
168168
169 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()169 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()
@@ -194,7 +194,7 @@
194 return194 return
195 account = session.query(Account).filter_by(id=event.account).first()195 account = session.query(Account).filter_by(id=event.account).first()
196 if not account:196 if not account:
197 event.addresponse(u"%s doesn't exist. Please use 'add account' first" % username)197 event.addresponse(u"%s doesn't exist. Please use 'add account' first", username)
198 return198 return
199199
200 else:200 else:
@@ -202,7 +202,7 @@
202 return202 return
203 account = session.query(Account).filter_by(username=username).first()203 account = session.query(Account).filter_by(username=username).first()
204 if not account:204 if not account:
205 event.addresponse(u"I don't know who %s is" % username)205 event.addresponse(u"I don't know who %s is", username)
206 return206 return
207207
208 account.attributes.append(Attribute(name, value))208 account.attributes.append(Attribute(name, value))
@@ -220,17 +220,17 @@
220 if username.upper() == 'I':220 if username.upper() == 'I':
221 if not event.account:221 if not event.account:
222 identity = session.query(Identity).get(event.identity)222 identity = session.query(Identity).get(event.identity)
223 event.addresponse(u"%s on %s" % (identity.identity, identity.source))223 event.addresponse(u"%s on %s", identity.identity, identity.source)
224 return224 return
225 account = session.query(Account).get(event.account)225 account = session.query(Account).get(event.account)
226226
227 else:227 else:
228 account = session.query(Account).filter_by(username=username).first()228 account = session.query(Account).filter_by(username=username).first()
229 if not account:229 if not account:
230 event.addresponse(u"I don't know who %s is" % username)230 event.addresponse(u"I don't know who %s is", username)
231 return231 return
232232
233 event.addresponse(u'%s is %s' % (account.username, ', '.join('%s on %s' % (identity.identity, identity.source) for identity in account.identities)))233 event.addresponse(u'%s is %s', account.username, ', '.join('%s on %s' % (identity.identity, identity.source) for identity in account.identities))
234 session.close()234 session.close()
235235
236class Identify(Processor):236class Identify(Processor):
237237
=== modified file 'ibid/plugins/imdb.py'
--- ibid/plugins/imdb.py 2009-02-23 14:59:37 +0000
+++ ibid/plugins/imdb.py 2009-02-26 09:53:00 +0000
@@ -48,7 +48,7 @@
48 self.imdb.update(result)48 self.imdb.update(result)
4949
50 except IMDbDataAccessError, e:50 except IMDbDataAccessError, e:
51 event.addresponse(u"IMDb doesn't like me today. It said '%s'" % e[0]["errmsg"])51 event.addresponse(u"IMDb doesn't like me today. It said '%s'", e[0]["errmsg"])
52 raise52 raise
5353
54 except IMDbError, e:54 except IMDbError, e:
@@ -56,7 +56,7 @@
56 raise56 raise
5757
58 if result is not None:58 if result is not None:
59 event.addresponse(u"Found " + getattr(self, "display_" + search_type)(result))59 event.addresponse(u"Found %s", getattr(self, "display_" + search_type)(result))
60 return60 return
6161
62 if len(results) == 0:62 if len(results) == 0:
@@ -66,7 +66,7 @@
66 results = enumerate(results)66 results = enumerate(results)
67 results = [u"%i: %s" % (x[0] + 1, x[1]) for x in results]67 results = [u"%i: %s" % (x[0] + 1, x[1]) for x in results]
68 more = (u"", u">")[len(results) == 20]68 more = (u"", u">")[len(results) == 20]
69 event.addresponse(u"Found %s%i matches: %s" % (more, len(results), u", ".join(results)))69 event.addresponse(u"Found %s%i matches: %s", more, len(results), u", ".join(results))
7070
71 def display_character(self, character):71 def display_character(self, character):
72 desc = u"%s: %s." % (character.characterID, character["long imdb name"])72 desc = u"%s: %s." % (character.characterID, character["long imdb name"])
7373
=== modified file 'ibid/plugins/info.py'
--- ibid/plugins/info.py 2009-02-23 20:29:44 +0000
+++ ibid/plugins/info.py 2009-02-26 09:53:00 +0000
@@ -41,7 +41,7 @@
41 def handle_nickometer(self, event, nick, wreasons):41 def handle_nickometer(self, event, nick, wreasons):
42 nick = nick or event.sender['nick']42 nick = nick or event.sender['nick']
43 score, reasons = nickometer(str(nick))43 score, reasons = nickometer(str(nick))
44 event.addresponse(u"%s is %s%% lame" % (nick, score))44 event.addresponse(u"%s is %s%% lame", nick, score)
45 if wreasons:45 if wreasons:
46 event.addresponse(u', '.join(['%s (%s)' % reason for reason in reasons]))46 event.addresponse(u', '.join(['%s (%s)' % reason for reason in reasons]))
4747
4848
=== modified file 'ibid/plugins/irc.py'
--- ibid/plugins/irc.py 2009-02-12 19:59:13 +0000
+++ ibid/plugins/irc.py 2009-02-26 09:53:00 +0000
@@ -27,15 +27,15 @@
27 source = ibid.sources[source.lower()]27 source = ibid.sources[source.lower()]
2828
29 if not hasattr(source, 'join'):29 if not hasattr(source, 'join'):
30 event.addresponse(u"%s cannot join/part channels" % (source.name,))30 event.addresponse(u"%s cannot join/part channels", source.name)
31 return31 return
3232
33 if action == 'join':33 if action == 'join':
34 source.join(channel)34 source.join(channel)
35 event.addresponse(u"Joining %s" % channel)35 event.addresponse(u"Joining %s", channel)
36 else:36 else:
37 source.part(channel)37 source.part(channel)
38 event.addresponse(u"Parting %s" % channel)38 event.addresponse(u"Parting %s", channel)
3939
40 @match(r'^change\s+nick\s+to\s+(\S+)(?:\s+on\s+(\S+))?$')40 @match(r'^change\s+nick\s+to\s+(\S+)(?:\s+on\s+(\S+))?$')
41 @authorise41 @authorise
@@ -46,9 +46,9 @@
46 source = ibid.sources[source.lower()]46 source = ibid.sources[source.lower()]
4747
48 if not hasattr(source, 'change_nick'):48 if not hasattr(source, 'change_nick'):
49 event.addresponse(u"%s cannot change nicks" % source)49 event.addresponse(u"%s cannot change nicks", source)
50 else:50 else:
51 source.change_nick(nick)51 source.change_nick(nick)
52 event.addresponse(u'Changing nick to %s' % nick)52 event.addresponse(u'Changing nick to %s', nick)
5353
54# vi: set et sta sw=4 ts=4:54# vi: set et sta sw=4 ts=4:
5555
=== modified file 'ibid/plugins/karma.py'
--- ibid/plugins/karma.py 2009-02-23 20:29:44 +0000
+++ ibid/plugins/karma.py 2009-02-26 09:53:00 +0000
@@ -94,9 +94,9 @@
94 session = ibid.databases.ibid()94 session = ibid.databases.ibid()
95 karma = session.query(Karma).filter(func.lower(Karma.subject)==subject.lower()).first()95 karma = session.query(Karma).filter(func.lower(Karma.subject)==subject.lower()).first()
96 if not karma:96 if not karma:
97 event.addresponse(u"%s has neutral karma" % subject)97 event.addresponse(u"%s has neutral karma",subject)
98 else:98 else:
99 event.addresponse(u"%s has karma of %s" % (subject, karma.value))99 event.addresponse(u"%s has karma of %s", subject, karma.value)
100 session.close()100 session.close()
101101
102 @match(r'^(reverse\s+)?karmaladder$')102 @match(r'^(reverse\s+)?karmaladder$')
103103
=== modified file 'ibid/plugins/lookup.py'
--- ibid/plugins/lookup.py 2009-02-22 10:37:32 +0000
+++ ibid/plugins/lookup.py 2009-02-26 09:53:00 +0000
@@ -243,9 +243,9 @@
243 def weather(self, event, place):243 def weather(self, event, place):
244 try:244 try:
245 values = self.remote_weather(place)245 values = self.remote_weather(place)
246 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)246 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)
247 except Weather.TooManyPlacesException, e:247 except Weather.TooManyPlacesException, e:
248 event.addresponse(u'Too many places match %s: %s' % (place, '; '.join(e.message)))248 event.addresponse(u'Too many places match %s: %s', place, '; '.join(e.message))
249 except Weather.WeatherException, e:249 except Weather.WeatherException, e:
250 event.addresponse(e.message)250 event.addresponse(e.message)
251251
@@ -254,7 +254,7 @@
254 try:254 try:
255 event.addresponse(u', '.join(self.remote_forecast(place)))255 event.addresponse(u', '.join(self.remote_forecast(place)))
256 except Weather.TooManyPlacesException, e:256 except Weather.TooManyPlacesException, e:
257 event.addresponse(u'Too many places match %s: %s' % (place, '; '.join(e.message)))257 event.addresponse(u'Too many places match %s: %s', place, '; '.join(e.message))
258 except Weather.WeatherException, e:258 except Weather.WeatherException, e:
259 event.addresponse(e.message)259 event.addresponse(e.message)
260260
261261
=== modified file 'ibid/plugins/memo.py'
--- ibid/plugins/memo.py 2009-02-23 20:29:44 +0000
+++ ibid/plugins/memo.py 2009-02-26 09:53:00 +0000
@@ -60,11 +60,11 @@
60 if not identity:60 if not identity:
61 identity = account.identities[0]61 identity = account.identities[0]
62 if not to:62 if not to:
63 event.addresponse(u"I don't know who %s is" % who)63 event.addresponse(u"I don't know who %s is", who)
64 return64 return
6565
66 if permission(u'recvmemo', to.account and to.account.id or None, to.source) != 'yes':66 if permission(u'recvmemo', to.account and to.account.id or None, to.source) != 'yes':
67 event.addresponse(u'Just tell %s yourself' % who)67 event.addresponse(u'Just tell %s yourself', who)
68 return68 return
6969
70 memo = Memo(event.identity, to.id, memo, how.lower() in ('pm', 'privmsg', 'msg'))70 memo = Memo(event.identity, to.id, memo, how.lower() in ('pm', 'privmsg', 'msg'))
@@ -153,7 +153,7 @@
153 session = ibid.databases.ibid()153 session = ibid.databases.ibid()
154 memos = get_memos(session, event, True)154 memos = get_memos(session, event, True)
155 memo = memos[int(number)]155 memo = memos[int(number)]
156 event.addresponse(u"From %s on %s at %s: %s" % (memo.sender.identity, memo.sender.source, memo.time.strftime(self.datetime_format), memo.memo))156 event.addresponse(u"From %s on %s at %s: %s", memo.sender.identity, memo.sender.source, memo.time.strftime(self.datetime_format), memo.memo)
157 session.close()157 session.close()
158158
159159
160160
=== modified file 'ibid/plugins/misc.py'
--- ibid/plugins/misc.py 2009-02-23 20:29:44 +0000
+++ ibid/plugins/misc.py 2009-02-26 09:53:00 +0000
@@ -26,7 +26,7 @@
26 26
27 self.pot = [event.sender['nick']]27 self.pot = [event.sender['nick']]
28 sleep(self.time)28 sleep(self.time)
29 event.addresponse(u"Coffee's ready for %s!" % u', '.join(self.pot))29 event.addresponse(u"Coffee's ready for %s!", u', '.join(self.pot))
30 self.pot = None30 self.pot = None
31 return event31 return event
32 32
@@ -53,7 +53,7 @@
5353
54 @match(r'^version$')54 @match(r'^version$')
55 def show_version(self, event):55 def show_version(self, event):
56 event.addresponse(version and u"I am version %s" % version or u"I don't know what version I am :-(")56 event.addresponse(version and u"I am version %s" or u"I don't know what version I am :-(", version)
5757
58help['dvorak'] = u"Makes text typed on a QWERTY keyboard as if it was Dvorak work, and vice-versa"58help['dvorak'] = u"Makes text typed on a QWERTY keyboard as if it was Dvorak work, and vice-versa"
59class Dvorak(Processor):59class Dvorak(Processor):
6060
=== modified file 'ibid/plugins/network.py'
--- ibid/plugins/network.py 2009-02-03 18:03:49 +0000
+++ ibid/plugins/network.py 2009-02-26 09:53:00 +0000
@@ -34,10 +34,10 @@
34 try:34 try:
35 answers = resolver.query(host, str(record))35 answers = resolver.query(host, str(record))
36 except NoAnswer:36 except NoAnswer:
37 event.addresponse(u"I couldn't find any %s records for %s" % (record, host))37 event.addresponse(u"I couldn't find any %s records for %s", record, host)
38 return38 return
39 except NXDOMAIN:39 except NXDOMAIN:
40 event.addresponse(u"I couldn't find the domain %s" % host)40 event.addresponse(u"I couldn't find the domain %s", host)
41 return41 return
4242
43 responses = []43 responses = []
4444
=== modified file 'ibid/plugins/seen.py'
--- ibid/plugins/seen.py 2009-02-18 19:05:10 +0000
+++ ibid/plugins/seen.py 2009-02-26 09:53:00 +0000
@@ -82,7 +82,7 @@
82 account = session.query(Account).filter_by(username=who).first()82 account = session.query(Account).filter_by(username=who).first()
8383
84 if not identity and not account:84 if not identity and not account:
85 event.addresponse(u"I don't know who %s is" % who)85 event.addresponse(u"I don't know who %s is", who)
86 return86 return
8787
88 messages = []88 messages = []
@@ -102,7 +102,7 @@
102 states.append(sighting)102 states.append(sighting)
103103
104 if len(messages) == 0 and len(states) == 0:104 if len(messages) == 0 and len(states) == 0:
105 event.addresponse(u"I haven't seen %s" % who)105 event.addresponse(u"I haven't seen %s", who)
106 return106 return
107107
108 messages.sort(key=lambda x: x.time, reverse=True)108 messages.sort(key=lambda x: x.time, reverse=True)
109109
=== modified file 'ibid/plugins/sources.py'
--- ibid/plugins/sources.py 2009-02-17 21:04:17 +0000
+++ ibid/plugins/sources.py 2009-02-26 09:53:00 +0000
@@ -15,26 +15,26 @@
15 def connect(self, event, source):15 def connect(self, event, source):
1616
17 if ibid.sources[source.lower()].connect():17 if ibid.sources[source.lower()].connect():
18 event.addresponse(u'Connecting to %s' % source)18 event.addresponse(u'Connecting to %s', source)
19 else:19 else:
20 event.addresponse(u"I couldn't connect to %s" % source)20 event.addresponse(u"I couldn't connect to %s", source)
2121
22 @match(r'^disconnect\s+(?:from\s+)?(\S+)$')22 @match(r'^disconnect\s+(?:from\s+)?(\S+)$')
23 @authorise23 @authorise
24 def disconnect(self, event, source):24 def disconnect(self, event, source):
2525
26 if ibid.sources[source.lower()].disconnect():26 if ibid.sources[source.lower()].disconnect():
27 event.addresponse(u'Disconnecting from %s' % source)27 event.addresponse(u'Disconnecting from %s', source)
28 else:28 else:
29 event.addresponse(u"I couldn't disconnect from %s" % source)29 event.addresponse(u"I couldn't disconnect from %s", source)
3030
31 @match(r'^(?:re)?load\s+(\S+)\s+source$')31 @match(r'^(?:re)?load\s+(\S+)\s+source$')
32 @authorise32 @authorise
33 def load(self, event, source):33 def load(self, event, source):
34 if ibid.reloader.load_source(source, ibid.service):34 if ibid.reloader.load_source(source, ibid.service):
35 event.addresponse(u"%s source loaded" % source)35 event.addresponse(u"%s source loaded", source)
36 else:36 else:
37 event.addresponse(u"Couldn't load %s source" % source)37 event.addresponse(u"Couldn't load %s source", source)
3838
39class Info(Processor):39class Info(Processor):
40 """(sources|list configured sources)"""40 """(sources|list configured sources)"""
4141
=== modified file 'ibid/plugins/test.py'
--- ibid/plugins/test.py 2009-01-12 17:35:59 +0000
+++ ibid/plugins/test.py 2009-02-26 09:53:00 +0000
@@ -25,6 +25,6 @@
25 @match(r'^email\s+(.+)$')25 @match(r'^email\s+(.+)$')
26 def email(self, event, address):26 def email(self, event, address):
27 event.addresponse({'reply': 'Test message', 'source': 'email', 'target': unicode(address)})27 event.addresponse({'reply': 'Test message', 'source': 'email', 'target': unicode(address)})
28 event.addresponse(u"I've emailed %s" % address)28 event.addresponse(u"I've emailed %s", address)
2929
30# vi: set et sta sw=4 ts=4:30# vi: set et sta sw=4 ts=4:

Subscribers

People subscribed via source and target branches