From 0fce3655d547987b62e2691b2e3ecb1909ff9c08 Mon Sep 17 00:00:00 2001 From: Massimo Date: Thu, 21 Mar 2013 15:10:32 -0500 Subject: [PATCH] enabling test_web tests in travis, thanks Niphlod --- VERSION | 2 +- gluon/contrib/webclient.py | 8 ++++++-- gluon/tests/__init__.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index ff589fc6..f54b6eb1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.4.5-stable+timestamp.2013.03.21.12.03.58 +Version 2.4.5-stable+timestamp.2013.03.21.15.09.50 diff --git a/gluon/contrib/webclient.py b/gluon/contrib/webclient.py index ec8d5fd2..aa2a25d6 100644 --- a/gluon/contrib/webclient.py +++ b/gluon/contrib/webclient.py @@ -15,12 +15,12 @@ mostly for testing purposes Some examples at the bottom. """ - import re import time import urllib import urllib2 + DEFAULT_HEADERS = { 'user-agent': 'Mozilla/4.0', # some servers are picky 'accept-language': 'en', @@ -126,7 +126,11 @@ class WebClient(object): self.time = time.time() - t0 self.response = error - self.status = self.response.getcode() + if hasattr(self.response, 'getcode'): + self.status = self.response.getcode() + else:#python2.5 + self.status = None + self.text = self.response.read() self.headers = dict(self.response.headers) diff --git a/gluon/tests/__init__.py b/gluon/tests/__init__.py index a0fc28d4..fc6e75cd 100644 --- a/gluon/tests/__init__.py +++ b/gluon/tests/__init__.py @@ -10,4 +10,4 @@ from test_template import * from test_utils import * from test_contribs import * from test_markmin import * -# from test_web import * +from test_web import *