# HG changeset patch # User souliane # Date 1400699680 -7200 # Node ID 59de0c7a28eca08726a41e5c8223023869aa1859 # Parent 9095263011b69bf4d89f0122062031f044f75a59 memory (params): fixes bugs in setParam: - symbol 'd' was accessed without having been initialized when setting the empty value to a password which is not the profile password - the method was actually returning without waiting for the parameter to be set diff -r 9095263011b6 -r 59de0c7a28ec src/memory/params.py --- a/src/memory/params.py Wed May 21 12:07:13 2014 +0200 +++ b/src/memory/params.py Wed May 21 21:14:40 2014 +0200 @@ -756,7 +756,8 @@ if type_ == "button": log.debug("Clicked param button %s" % node.toxml()) return defer.succeed(None) - elif type_ == "password": + d = defer.succeed(value) + if type_ == "password": try: personal_key = self.host.memory.auth_sessions.profileGetUnique(profile)[C.MEMORY_CRYPTO_KEY] except TypeError: @@ -770,17 +771,16 @@ d = PasswordHasher.hash(value) # profile password is hashed (empty value stays empty) elif value: # other non empty passwords are encrypted with the personal key d = BlockCipher.encrypt(personal_key, value) - else: - d = defer.succeed(value) def gotFinalValue(value): if self.host.isConnected(profile): # key can not exists if profile is not connected self.params[profile][(category, name)] = value self.host.bridge.paramUpdate(name, value, category, profile) self.host.trigger.point("paramUpdateTrigger", name, value, category, node[0], profile) - d_list.append(self.storage.setIndParam(category, name, value, profile)) + return self.storage.setIndParam(category, name, value, profile) d.addCallback(gotFinalValue) + d_list.append(d) return defer.DeferredList(d_list).addCallback(lambda dummy: None) def _getNodesOfTypes(self, attr_type, node_type="@ALL@"):