fix google calc to work when doing a currency conversion.

made the calcre more generic, so it finds stuff on both math and currency.
nothing a little exploration of google html page source couldn't solve.
This commit is contained in:
Daniel Folkinshteyn 2010-06-02 18:36:27 -04:00 committed by Valentin Lorentz
parent 2925c45b51
commit 8e80e7b657
2 changed files with 1 additions and 3 deletions

View File

@ -327,8 +327,7 @@ class Google(callbacks.PluginRegexp):
url = r'http://google.com/search?q=' + s
return url
_calcRe1 = re.compile(r'<table.*class="?obcontainer"?[^>]*>(.*?)</table>', re.I)
_calcRe2 = re.compile(r'<h\d class="?r"?.*?<b>(.*?)</b>', re.I)
_calcRe = re.compile(r'<h\d class="?r"?.*?<b>(.*?)</b>', re.I)
_calcSupRe = re.compile(r'<sup>(.*?)</sup>', re.I)
_calcFontRe = re.compile(r'<font size=-2>(.*?)</font>')
_calcTimesRe = re.compile(r'&(?:times|#215);')

View File

@ -39,7 +39,6 @@ class GoogleTestCase(ChannelPluginTestCase):
def testCalc(self):
self.assertNotRegexp('google calc e^(i*pi)+1', r'didn\'t')
self.assertNotRegexp('google calc 1 usd in gbp', r'didn\'t')
self.assertRegexp('google calc current time in usa', r'Time in.*USA')
def testHtmlHandled(self):
self.assertNotRegexp('google calc '