default to index mode of deltatar object when choosing extension
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Tue, 16 May 2017 11:37:43 +0000 (13:37 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 2 Apr 2018 11:34:08 +0000 (13:34 +0200)
For external use.

deltatar/deltatar.py

index 0e42260..46c9155 100644 (file)
@@ -268,7 +268,7 @@ class DeltaTar(object):
         if volume_name_func is not None:
             self.volume_name_func = volume_name_func
 
-    def pick_extension(self, kind, mode):
+    def pick_extension(self, kind, mode=None):
         """
         Choose the extension depending on a) the kind of file given, b) the
         processing mode, and c) the current encryption settings.
@@ -276,8 +276,10 @@ class DeltaTar(object):
         ret = ""
         if kind == PDT_TYPE_ARCHIVE:
             ret += ".tar"
+        if mode is None:
+            mode = self.__index_extensions_dict [self.index_mode]
         ret += mode
-        if self.encryptor is not None or self.decryptor is not None:
+        if self.password is not None:
             ret += "." + PDTCRYPT_EXTENSION
         return ret