From 83361093da4fed2209d4aa790e584023a6e57e1d Mon Sep 17 00:00:00 2001 From: harlowja Date: Wed, 20 Jun 2012 00:41:39 -0700 Subject: Use comparisons instead of xrange, until python 3 when it should be more efficent --- cloudinit/url_helper.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cloudinit') diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py index c69da1bb..1c583eba 100644 --- a/cloudinit/url_helper.py +++ b/cloudinit/url_helper.py @@ -59,11 +59,14 @@ class UrlResponse(object): return str(self.contents) def ok(self, redirects_ok=False): + upper = 300 if redirects_ok: - return self.code in xrange(200, 400) + upper = 400 + if self.code >= 200 and self.code < upper: + return True else: - return self.code in xrange(200, 300) - + return False + def readurl(url, data=None, timeout=None, retries=0, sec_between=1, headers=None): -- cgit v1.2.3