Dict: Fix lookup of some words (looks like dict.org does not follow RFC2229). Closes GH-494.

This commit is contained in:
Valentin Lorentz 2013-08-07 15:41:08 +00:00
parent 80b4e164ec
commit 58261e78c7
2 changed files with 4 additions and 1 deletions

View File

@ -54,6 +54,8 @@ class Connection:
consisting of two items: the integer result code and the text
following. You will not usually use this function directly."""
line = self.rfile.readline().decode('utf8').strip()
if line.startswith('['):
return [None, line]
code, text = line.split(' ', 1)
return [int(code), text]
@ -194,7 +196,7 @@ class Connection:
while 1:
code, text = self.getresultcode()
if code != 151:
if code != 151 or code is None:
break
resultword, resultdb = re.search('^"(.+)" (\S+)', text).groups()

View File

@ -35,6 +35,7 @@ class DictTestCase(PluginTestCase):
if network:
def testDict(self):
self.assertNotError('dict slash')
self.assertNotError('dict flutter')
self.assertNotRegexp('dict web1913 slash', 'foldoc')
self.assertError('dict ""')
self.assertRegexp('dict eng-fra school', 'école')