diff options
author | andy <andy@whiskeymedia.com> | 2013-06-06 11:30:23 -0700 |
---|---|---|
committer | andy <andy@whiskeymedia.com> | 2013-06-06 11:30:23 -0700 |
commit | 6a69aa50797f95b8fd426651ac0b27d7718036d9 (patch) | |
tree | 33bc095766d7193aabc2c7a903c00c52b64c0a8f /redis/connection.py | |
parent | a207d76939b640634095a49c4790003839a0a669 (diff) | |
download | redis-py-6a69aa50797f95b8fd426651ac0b27d7718036d9.tar.gz |
encoding tests
Diffstat (limited to 'redis/connection.py')
-rw-r--r-- | redis/connection.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/redis/connection.py b/redis/connection.py index 343c838..7e8cb44 100644 --- a/redis/connection.py +++ b/redis/connection.py @@ -16,12 +16,9 @@ from redis.exceptions import ( NoScriptError, ExecAbortError, ) - -try: +from redis.utils import HIREDIS_AVAILABLE +if HIREDIS_AVAILABLE: import hiredis - hiredis_available = True -except ImportError: - hiredis_available = False SYM_STAR = b('*') @@ -145,7 +142,7 @@ class PythonParser(object): class HiredisParser(object): "Parser class for connections using Hiredis" def __init__(self): - if not hiredis_available: + if not HIREDIS_AVAILABLE: raise RedisError("Hiredis is not installed") def __del__(self): @@ -189,7 +186,7 @@ class HiredisParser(object): response = self._reader.gets() return response -if hiredis_available: +if HIREDIS_AVAILABLE: DefaultParser = HiredisParser else: DefaultParser = PythonParser |