From 75b6da806e5b62a0085e7b69ee3047e30f2a5094 Mon Sep 17 00:00:00 2001 From: James Vega Date: Wed, 21 Jan 2004 01:33:59 +0000 Subject: [PATCH] Clean up the registry calls --- plugins/Amazon.py | 20 ++++++++++---------- plugins/Bugzilla.py | 14 +++++++------- plugins/Google.py | 8 ++++---- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/plugins/Amazon.py b/plugins/Amazon.py index e5b4691e3..d1e8b9a63 100644 --- a/plugins/Amazon.py +++ b/plugins/Amazon.py @@ -139,7 +139,7 @@ class Amazon(callbacks.Privmsg): '%(publisher)s%(url)s' try: book = amazon.searchByKeyword(isbn) - bold = conf.supybot.plugins.Amazon.bold() + bold = self.registryValue('bold', msg.args[0]) res = self._genResults(s, attribs, book, url, bold, 'title') if res: irc.reply(utils.commaAndify(res)) @@ -172,7 +172,7 @@ class Amazon(callbacks.Privmsg): '%(publisher)s%(url)s' try: books = amazon.searchByKeyword(keyword) - bold = conf.supybot.plugins.Amazon.bold() + bold = self.registryValue('bold', msg.args[0]) res = self._genResults(s, attribs, books, url, bold, 'title') if res: irc.reply(utils.commaAndify(res)) @@ -211,7 +211,7 @@ class Amazon(callbacks.Privmsg): '%(date)s; published by %(publisher)s%(url)s' try: videos = amazon.searchByKeyword(keyword, product_line=product) - bold = conf.supybot.plugins.Amazon.bold() + bold = self.registryValue('bold', msg.args[0]) res = self._genResults(s, attribs, videos, url, bold, 'title') if res: irc.reply(utils.commaAndify(res)) @@ -242,7 +242,7 @@ class Amazon(callbacks.Privmsg): s = '"%(title)s"%(url)s' try: item = amazon.searchByASIN(asin) - bold = conf.supybot.plugins.Amazon.bold() + bold = self.registryValue('bold', msg.args[0]) res = self._genResults(s, attribs, item, url, bold, 'title') if res: irc.reply(utils.commaAndify(res)) @@ -276,7 +276,7 @@ class Amazon(callbacks.Privmsg): s = '"%(title)s" %(manufacturer)s%(url)s' try: item = amazon.searchByUPC(upc) - bold = conf.supybot.plugins.Amazon.bold() + bold = self.registryValue('bold', msg.args[0]) res = self._genResults(s, attribs, item, url, bold, 'title') if res: irc.reply(utils.commaAndify(res)) @@ -309,7 +309,7 @@ class Amazon(callbacks.Privmsg): '%(publisher)s%(url)s' try: books = amazon.searchByAuthor(author) - bold = conf.supybot.plugins.Amazon.bold() + bold = self.registryValue('bold', msg.args[0]) res = self._genResults(s, attribs, books, url, bold, 'title') if res: irc.reply(utils.commaAndify(res)) @@ -407,7 +407,7 @@ class Amazon(callbacks.Privmsg): '%(publisher)s%(url)s' try: items = amazon.searchByArtist(artist, product_line=product) - bold = conf.supybot.plugins.Amazon.bold() + bold = self.registryValue('bold', msg.args[0]) res = self._genResults(s, attribs, items, url, bold, 'title') if res: irc.reply(utils.commaAndify(res)) @@ -447,7 +447,7 @@ class Amazon(callbacks.Privmsg): '%(date)s; published by %(publisher)s%(url)s' try: items = amazon.searchByActor(actor, product_line=product) - bold = conf.supybot.plugins.Amazon.bold() + bold = self.registryValue('bold', msg.args[0]) res = self._genResults(s, attribs, items, url, bold, 'title') if res: irc.reply(utils.commaAndify(res)) @@ -487,7 +487,7 @@ class Amazon(callbacks.Privmsg): '%(date)s; published by %(publisher)s%(url)s' try: items = amazon.searchByDirector(director, product_line=product) - bold = conf.supybot.plugins.Amazon.bold() + bold = self.registryValue('bold', msg.args[0]) res = self._genResults(s, attribs, items, url, bold, 'title') if res: irc.reply(utils.commaAndify(res)) @@ -526,7 +526,7 @@ class Amazon(callbacks.Privmsg): try: items = amazon.searchByManufacturer(manufacturer, product_line=product) - bold = conf.supybot.plugins.Amazon.bold() + bold = self.registryValue('bold', msg.args[0]) res = self._genResults(s, attribs, items, url, bold, 'title') if res: irc.reply(utils.commaAndify(res)) diff --git a/plugins/Bugzilla.py b/plugins/Bugzilla.py index 855b054ac..00700d379 100644 --- a/plugins/Bugzilla.py +++ b/plugins/Bugzilla.py @@ -107,7 +107,7 @@ conf.registerChannelValue(conf.supybot.plugins.Bugzilla, 'bugSnarfer', information reported into the channel.""")) conf.registerChannelValue(conf.supybot.plugins.Bugzilla, 'bold', registry.Boolean(True, """Determines whether results are bolded.""")) -conf.registerGlobalValue(conf.supybot.plugins.Bugzilla, 'replyNoBugzilla', +conf.registerChannellValue(conf.supybot.plugins.Bugzilla, 'replyNoBugzilla', registry.String('I don\'t have a bugzilla %r.', """Determines the phrase to use when notifying the user that there is no information about that bugzilla site.""")) @@ -172,7 +172,7 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp): self.shorthand = utils.abbrev(self.db.keys()) irc.replySuccess() except KeyError: - s = conf.supybot.plugins.Bugzilla.replyNoBugzilla() + s = self.registryValue('replyNoBugzilla', msg.args[0]) irc.error(s % name) def list(self, irc, msg, args): @@ -188,7 +188,7 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp): (url, description) = self.db[name] irc.reply('%s: %s, %s' % (name, description, url)) except KeyError: - s = conf.supybot.plugins.Bugzilla.replyNoBugzilla() + s = self.registryValue('replyNoBugzilla', msg.args[0]) irc.error(s % name) else: if self.db: @@ -200,7 +200,7 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp): def bzSnarfer(self, irc, msg, match): r"(http://\S+)/show_bug.cgi\?id=([0-9]+)" - if not conf.supybot.plugins.Bugzilla.bugSnarfer(): + if not self.registryValue('bugSnarfer', msg.args[0]): return queryurl = '%s/xml.cgi?id=%s' % (match.group(1), match.group(2)) try: @@ -271,7 +271,7 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp): name = self.shorthand[name] (url, description) = self.db[name] except KeyError: - s = conf.supybot.plugins.Bugzilla.replyNoBugzilla() + s = self.registryValue('replyNoBugzilla', msg.args[0]) irc.error(s % name) return bugs = self.urlquery2bugslist(url, query) @@ -292,7 +292,7 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp): name = self.shorthand[name] (url, description) = self.db[name] except KeyError: - s = conf.supybot.plugins.Bugzilla.replyNoBugzilla() + s = self.registryValue('replyNoBugzilla', msg.args[0]) irc.error(s % name) return queryurl = '%s/xml.cgi?id=%s' % (url, number) @@ -315,7 +315,7 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp): def _mk_summary_string(self, summary): L = [] - if conf.supybot.plugins.Bugzilla.bold(): + if self.registryValue('bold', msg.args[0]): decorate = lambda s: ircutils.bold(s) else: decorate = lambda s: s diff --git a/plugins/Google.py b/plugins/Google.py index 2ee9755bb..6eafd9077 100644 --- a/plugins/Google.py +++ b/plugins/Google.py @@ -221,8 +221,8 @@ class Google(callbacks.PrivmsgCommandAndRegexp): except google.NoLicenseKey, e: irc.error(str(e)) return - bold = conf.supybot.plugins.Google.bold() - max = conf.supybot.plugins.Google.maximumResults() + bold = self.registryValue('bold', msg.args[0]) + max = self.registryValue('maximumResults', msg.args[0]) irc.reply(self.formatData(data, bold=bold, max=max)) def metagoogle(self, irc, msg, args): @@ -302,7 +302,7 @@ class Google(callbacks.PrivmsgCommandAndRegexp): def googleSnarfer(self, irc, msg, match): r"^google\s+(.*)$" - if not conf.supybot.plugins.Google.searchSnarfer(): + if not self.registryValue('searchSnarfer', msg.args[0]): return searchString = match.group(1) try: @@ -322,7 +322,7 @@ class Google(callbacks.PrivmsgCommandAndRegexp): _ggPlainGroup = re.compile(r'Newsgroups: (.*)') def googleGroups(self, irc, msg, match): r"http://groups.google.com/[^\s]+" - if not conf.supybot.plugins.Google.groupsSnarfer(): + if not self.registryValue('groupsSnarfer', msg.args[0]): return request = urllib2.Request(match.group(0), headers= \ {'User-agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)'})