summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slixmpp/util/cache.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/slixmpp/util/cache.py b/slixmpp/util/cache.py
index 059eca5b..79498d5e 100644
--- a/slixmpp/util/cache.py
+++ b/slixmpp/util/cache.py
@@ -53,8 +53,8 @@ class MemoryPerJidCache(PerJidCache):
class FileSystemStorage:
def __init__(self, encode, decode, binary):
- self.encode = encode
- self.decode = decode
+ self.encode = encode if encode is not None else lambda x: x
+ self.decode = decode if decode is not None else lambda x: x
self.read = 'rb' if binary else 'r'
self.write = 'wb' if binary else 'w'
@@ -81,7 +81,7 @@ class FileSystemStorage:
return False
class FileSystemCache(Cache, FileSystemStorage):
- def __init__(self, directory, cache_type, *, encode, decode, binary=False):
+ def __init__(self, directory, cache_type, *, encode=None, decode=None, binary=False):
FileSystemStorage.__init__(self, encode, decode, binary)
self.base_dir = os.path.join(directory, cache_type)
@@ -92,7 +92,7 @@ class FileSystemCache(Cache, FileSystemStorage):
return self._store(self.base_dir, key, value)
class FileSystemPerJidCache(PerJidCache, FileSystemStorage):
- def __init__(self, directory, cache_type, *, encode, decode, binary=False):
+ def __init__(self, directory, cache_type, *, encode=None, decode=None, binary=False):
FileSystemStorage.__init__(self, encode, decode, binary)
self.base_dir = os.path.join(directory, cache_type)