Parcourir la source

Restore set_callback , it is used by the db converter

oz123 il y a 10 ans
Parent
commit
3b42366c30
3 fichiers modifiés avec 16 ajouts et 12 suppressions
  1. 4 0
      pwman/tests/db_tests.py
  2. BIN
      pwman/tests/pwman.v0.0.8.db
  3. 12 12
      pwman/util/crypto.py

+ 4 - 0
pwman/tests/db_tests.py

@@ -37,6 +37,10 @@ import os
 import os.path
 import sys
 
+
+# TODO: fix hard coded db versions! 0.4 should be replaced with
+#  from pwman.data.database import __DB_FORMAT__
+
 _saveconfig = False
 
 PwmanCliNew, OSX = get_ui_platform(sys.platform)

BIN
pwman/tests/pwman.v0.0.8.db


+ 12 - 12
pwman/util/crypto.py

@@ -228,17 +228,18 @@ class CryptoEngine(object):
         """
         return self._keycrypted
 
-    #def set_callback(self, callback):
-    #    """
-    #    set the callback function
-    #    """
-    #    self._callback = callback
-
-    #def get_callback(self):
-    #    """
-    #    return call back function
-    #    """
-    #    return self._callback
+    def set_callback(self, callback):
+        """
+        set the callback function
+        """
+        self._callback = callback
+
+    @property
+    def callback(self):
+        """
+        return call back function
+        """
+        return self._callback
 
     def changepassword(self):
         """
@@ -476,7 +477,6 @@ class CryptoEngineOld(CryptoEngine):
         """
         prepare data before encrypting
         """
-        # plaintext = cPickle.dumps(obj)
         plaintext = _TAG + obj
         numblocks = (len(plaintext)/blocksize) + 1
         newdatasize = blocksize*numblocks