From: Ben Darnell Date: Mon, 11 Oct 2010 21:39:38 +0000 (-0700) Subject: Make USE_SIMPLE_HTTPCLIENT work without pycurl installed. X-Git-Tag: v1.2.0~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=925af5045c8eeb1727837c1cc9129d14aec50e76;p=thirdparty%2Ftornado.git Make USE_SIMPLE_HTTPCLIENT work without pycurl installed. --- diff --git a/tornado/httpclient.py b/tornado/httpclient.py index 0c5d8e68b..5bf10f7a1 100644 --- a/tornado/httpclient.py +++ b/tornado/httpclient.py @@ -26,7 +26,14 @@ import errno import httplib import logging import os -import pycurl +try: + import pycurl +except ImportError: + # See the other check for this variable at end of file + if os.environ.get('USE_SIMPLE_HTTPCLIENT'): + pycurl = None + else: + raise import sys import threading import time diff --git a/tornado/test/httpserver_test.py b/tornado/test/httpserver_test.py index 6174d0afa..44a38b379 100644 --- a/tornado/test/httpserver_test.py +++ b/tornado/test/httpserver_test.py @@ -3,7 +3,10 @@ from tornado.testing import AsyncHTTPTestCase, LogTrapTestCase from tornado.web import Application, RequestHandler import os -import pycurl +try: + import pycurl +except ImportError: + pycurl = None import re import unittest import urllib @@ -52,7 +55,7 @@ class SSLTest(AsyncHTTPTestCase, LogTrapTestCase): body='A'*5000) self.assertEqual(response.body, "Got 5000 bytes in POST") -if (ssl is None or +if (ssl is None or pycurl is None or (pycurl.version_info()[5].startswith('GnuTLS') and pycurl.version_info()[2] < 0x71400)): # Don't try to run ssl tests if we don't have the ssl module (python 2.5).