diff options
| author | Sean Reifschneider <jafo@tummy.com> | 2009-04-02 12:31:06 -0600 |
|---|---|---|
| committer | Sean Reifschneider <jafo@tummy.com> | 2009-04-02 12:31:06 -0600 |
| commit | 74dbc2476fb1aadf64081e9a3c5f18a41268773a (patch) | |
| tree | 10fa3a55775d60f02a57e8dd276d043f501d822c /memcache.py | |
| parent | fbd44295ce22777d5a0b7693aa6a6b73b4fa3b7e (diff) | |
| download | python-memcached-74dbc2476fb1aadf64081e9a3c5f18a41268773a.tar.gz | |
Detecting when the pickler needs a positional argument.
Diffstat (limited to 'memcache.py')
| -rw-r--r-- | memcache.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/memcache.py b/memcache.py index a03b058..df0be58 100644 --- a/memcache.py +++ b/memcache.py @@ -160,7 +160,15 @@ class Client(local): self.unpickler = unpickler self.persistent_load = pload self.persistent_id = pid - + + # figure out the pickler style + file = StringIO() + try: + pickler = self.pickler(file, protocol = self.pickleProtocol) + self.picklerIsKeyword = True + except TypeError: + self.picklerIsKeyword = False + def set_servers(self, servers): """ Set the pool of servers used by this client. @@ -606,7 +614,10 @@ class Client(local): else: flags |= Client._FLAG_PICKLE file = StringIO() - pickler = self.pickler(file, protocol=self.pickleProtocol) + if self.picklerIsKeyword: + pickler = self.pickler(file, protocol = self.pickleProtocol) + else: + pickler = self.pickler(file, self.pickleProtocol) if self.persistent_id: pickler.persistent_id = self.persistent_id pickler.dump(val) |
