]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Make USE_SIMPLE_HTTPCLIENT work without pycurl installed.
authorBen Darnell <ben@bendarnell.com>
Mon, 11 Oct 2010 21:39:38 +0000 (14:39 -0700)
committerBen Darnell <ben@bendarnell.com>
Mon, 11 Oct 2010 21:57:37 +0000 (14:57 -0700)
tornado/httpclient.py
tornado/test/httpserver_test.py

index 0c5d8e68b9a1eda2646711323eecc2ff97480aa0..5bf10f7a1e7bda2a1ca44e17403bb1c75ea54e21 100644 (file)
@@ -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
index 6174d0afabb8f8f2121192bc991c80c0c97f61b9..44a38b379e31733ad1747752d7029608e5d7f283 100644 (file)
@@ -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).