mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Dict: Fix lookup of some words (looks like dict.org does not follow RFC2229). Closes GH-494.
This commit is contained in:
parent
80b4e164ec
commit
58261e78c7
@ -54,6 +54,8 @@ class Connection:
|
|||||||
consisting of two items: the integer result code and the text
|
consisting of two items: the integer result code and the text
|
||||||
following. You will not usually use this function directly."""
|
following. You will not usually use this function directly."""
|
||||||
line = self.rfile.readline().decode('utf8').strip()
|
line = self.rfile.readline().decode('utf8').strip()
|
||||||
|
if line.startswith('['):
|
||||||
|
return [None, line]
|
||||||
code, text = line.split(' ', 1)
|
code, text = line.split(' ', 1)
|
||||||
return [int(code), text]
|
return [int(code), text]
|
||||||
|
|
||||||
@ -194,7 +196,7 @@ class Connection:
|
|||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
code, text = self.getresultcode()
|
code, text = self.getresultcode()
|
||||||
if code != 151:
|
if code != 151 or code is None:
|
||||||
break
|
break
|
||||||
|
|
||||||
resultword, resultdb = re.search('^"(.+)" (\S+)', text).groups()
|
resultword, resultdb = re.search('^"(.+)" (\S+)', text).groups()
|
||||||
|
@ -35,6 +35,7 @@ class DictTestCase(PluginTestCase):
|
|||||||
if network:
|
if network:
|
||||||
def testDict(self):
|
def testDict(self):
|
||||||
self.assertNotError('dict slash')
|
self.assertNotError('dict slash')
|
||||||
|
self.assertNotError('dict flutter')
|
||||||
self.assertNotRegexp('dict web1913 slash', 'foldoc')
|
self.assertNotRegexp('dict web1913 slash', 'foldoc')
|
||||||
self.assertError('dict ""')
|
self.assertError('dict ""')
|
||||||
self.assertRegexp('dict eng-fra school', 'école')
|
self.assertRegexp('dict eng-fra school', 'école')
|
||||||
|
Loading…
Reference in New Issue
Block a user