From 58261e78c73560c386c36421abae8c84a2d1d21d Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 7 Aug 2013 15:41:08 +0000 Subject: [PATCH] Dict: Fix lookup of some words (looks like dict.org does not follow RFC2229). Closes GH-494. --- plugins/Dict/local/dictclient.py | 4 +++- plugins/Dict/test.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/Dict/local/dictclient.py b/plugins/Dict/local/dictclient.py index 7cd9e19fe..64cef4097 100644 --- a/plugins/Dict/local/dictclient.py +++ b/plugins/Dict/local/dictclient.py @@ -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() diff --git a/plugins/Dict/test.py b/plugins/Dict/test.py index 7a8649709..983bf4688 100644 --- a/plugins/Dict/test.py +++ b/plugins/Dict/test.py @@ -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')