Browse Source

add auto_connect __init__ parameter

master
Brett Langdon 12 years ago
parent
commit
1f2f3bb965
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      riakcached/client.py

+ 4
- 2
riakcached/client.py View File

@ -21,13 +21,12 @@ class RiakClient(object):
"url", "url",
] ]
def __init__(self, bucket, url="http://127.0.0.1:8098", timeout=2):
def __init__(self, bucket, url="http://127.0.0.1:8098", timeout=2, auto_connect=True):
""" """
""" """
self.bucket = bucket self.bucket = bucket
self.url = url.strip("/") self.url = url.strip("/")
self._timeout = timeout self._timeout = timeout
self._connect()
self._serializers = { self._serializers = {
"application/json": json.dumps, "application/json": json.dumps,
} }
@ -35,6 +34,9 @@ class RiakClient(object):
"application/json": json.loads, "application/json": json.loads,
} }
if auto_connect:
self._connect()
def setup_serializer(self, content_type, serializer, deserializer): def setup_serializer(self, content_type, serializer, deserializer):
""" """
""" """


Loading…
Cancel
Save