summaryrefslogtreecommitdiff
path: root/cloudinit/url_helper.py
diff options
context:
space:
mode:
authorharlowja <harlowja@virtualbox.rhel>2012-06-20 00:41:39 -0700
committerharlowja <harlowja@virtualbox.rhel>2012-06-20 00:41:39 -0700
commit83361093da4fed2209d4aa790e584023a6e57e1d (patch)
treed8cff8aced2365f82baf5326df163fb6877b7ba4 /cloudinit/url_helper.py
parent5859fd60454016e5e7b50a9d9d665e5aeb2da3b1 (diff)
downloadvyos-cloud-init-83361093da4fed2209d4aa790e584023a6e57e1d.tar.gz
vyos-cloud-init-83361093da4fed2209d4aa790e584023a6e57e1d.zip
Use comparisons instead of xrange, until python 3 when it should be more efficent
Diffstat (limited to 'cloudinit/url_helper.py')
-rw-r--r--cloudinit/url_helper.py9
1 files changed, 6 insertions, 3 deletions
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):