# HG changeset patch # User Atul Varma # Date 1262297949 28800 # Node ID 7b6bec6898056032b6244a68a01d9a762b22a4df # Parent 98f1da3b585cf137f6b6e13d1ca145f47941db85 forgot to use a file-like object as urlopen's return value diff -r 98f1da3b585c -r 7b6bec689805 test.py --- a/test.py Thu Dec 31 13:33:28 2009 -0800 +++ b/test.py Thu Dec 31 14:19:09 2009 -0800 @@ -1,4 +1,5 @@ import unittest +import StringIO from copy import deepcopy import whoisi_cache @@ -36,7 +37,7 @@ urlopen=self.fake_open) def fake_open(self, url): - return json.dumps(self.urls[url]) + return StringIO.StringIO(json.dumps(self.urls[url])) def testGetMaxPersonIDWorks(self): self.urls = { diff -r 98f1da3b585c -r 7b6bec689805 whoisi_cache.py --- a/whoisi_cache.py Thu Dec 31 13:33:28 2009 -0800 +++ b/whoisi_cache.py Thu Dec 31 14:19:09 2009 -0800 @@ -28,7 +28,7 @@ full_url = "%sapi/%s?%s" % (self.url, name, urllib.urlencode(query_args)) logging.debug('retrieving %s' % full_url) - return json.loads(self._urlopen(full_url)) + return json.loads(self._urlopen(full_url).read()) def get_person(self, app, person): return self._call_api_method('getPerson',