massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
This commit is contained in:
parent
cc829beac7
commit
67ff77e5de
4 changed files with 272 additions and 271 deletions
|
|
@ -131,9 +131,9 @@ class Discovery(object):
|
|||
# we cache items only for our own server
|
||||
try:
|
||||
items = self.host.memory.getEntityData(jid_, ["DISCO_ITEMS"], client.profile)["DISCO_ITEMS"]
|
||||
log.debug("[%s] disco items are in cache" % jid_.full())
|
||||
log.debug(u"[%s] disco items are in cache" % jid_.full())
|
||||
except (KeyError, exceptions.UnknownEntityError):
|
||||
log.debug("Caching [%s] disco items" % jid_.full())
|
||||
log.debug(u"Caching [%s] disco items" % jid_.full())
|
||||
items = yield client.disco.requestItems(jid_, nodeIdentifier)
|
||||
self.host.memory.updateEntityData(jid_, "DISCO_ITEMS", items, profile_key=client.profile)
|
||||
else:
|
||||
|
|
@ -144,7 +144,7 @@ class Discovery(object):
|
|||
|
||||
def _infosEb(self, failure, entity_jid):
|
||||
failure.trap(StanzaError)
|
||||
log.warning(_("Error while requesting [%(jid)s]: %(error)s") % {'jid': entity_jid.full(),
|
||||
log.warning(_(u"Error while requesting [%(jid)s]: %(error)s") % {'jid': entity_jid.full(),
|
||||
'error': failure.getErrorMessage()})
|
||||
|
||||
def findServiceEntities(self, category, type_, jid_=None, profile_key=C.PROF_KEY_NONE):
|
||||
|
|
@ -243,7 +243,7 @@ class Discovery(object):
|
|||
s.append('<')
|
||||
#TODO: manage XEP-0128 data form here
|
||||
cap_hash = b64encode(sha1(''.join(s)).digest())
|
||||
log.debug(_('Capability hash generated: [%s]') % cap_hash)
|
||||
log.debug(_(u'Capability hash generated: [%s]') % cap_hash)
|
||||
return cap_hash
|
||||
|
||||
@defer.inlineCallbacks
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class Sessions(object):
|
|||
session_id = str(uuid4())
|
||||
elif session_id in self._sessions:
|
||||
self._sessions[session_id][0].cancel()
|
||||
log.warning("Session [{id}] is going to be re-initialised".format(id=session_id))
|
||||
log.warning(u"Session [{id}] is going to be re-initialised".format(id=session_id))
|
||||
timer = reactor.callLater(self.timeout, self._purgeSession, session_id)
|
||||
if session_data is None:
|
||||
session_data = {}
|
||||
|
|
@ -75,7 +75,7 @@ class Sessions(object):
|
|||
|
||||
def _purgeSession(self, session_id):
|
||||
del self._sessions[session_id]
|
||||
log.debug("Session [%s] purged" % session_id)
|
||||
log.debug(u"Session [%s] purged" % session_id)
|
||||
|
||||
def __len__(self):
|
||||
return len(self._sessions)
|
||||
|
|
@ -113,7 +113,7 @@ class Sessions(object):
|
|||
timer.cancel()
|
||||
self._purgeSession(session_id)
|
||||
except KeyError:
|
||||
log.debug("Session [%s] doesn't exists, timeout expired?" % session_id)
|
||||
log.debug(u"Session [%s] doesn't exists, timeout expired?" % session_id)
|
||||
|
||||
def keys(self):
|
||||
return self._sessions.keys()
|
||||
|
|
@ -204,7 +204,7 @@ def fixLocalDir(silent=True):
|
|||
old_default = '~/.sat'
|
||||
if os.path.isfile(os.path.expanduser(old_default) + '/' + C.SAVEFILE_DATABASE):
|
||||
if not silent:
|
||||
log.warning(_("A database has been found in the default local_dir for previous versions (< 0.5)"))
|
||||
log.warning(_(u"A database has been found in the default local_dir for previous versions (< 0.5)"))
|
||||
tools_config.fixConfigOption('', 'local_dir', old_default, silent)
|
||||
|
||||
|
||||
|
|
@ -269,10 +269,10 @@ class Memory(object):
|
|||
if os.path.exists(filename):
|
||||
try:
|
||||
self.params.load_xml(filename)
|
||||
log.debug(_("Parameters loaded from file: %s") % filename)
|
||||
log.debug(_(u"Parameters loaded from file: %s") % filename)
|
||||
return True
|
||||
except Exception as e:
|
||||
log.error(_("Can't load parameters from file: %s") % e)
|
||||
log.error(_(u"Can't load parameters from file: %s") % e)
|
||||
return False
|
||||
|
||||
def save_xml(self, filename):
|
||||
|
|
@ -287,10 +287,10 @@ class Memory(object):
|
|||
filename = os.path.expanduser(filename)
|
||||
try:
|
||||
self.params.save_xml(filename)
|
||||
log.debug(_("Parameters saved to file: %s") % filename)
|
||||
log.debug(_(u"Parameters saved to file: %s") % filename)
|
||||
return True
|
||||
except Exception as e:
|
||||
log.error(_("Can't save parameters to file: %s") % e)
|
||||
log.error(_(u"Can't save parameters to file: %s") % e)
|
||||
return False
|
||||
|
||||
def load(self):
|
||||
|
|
@ -323,7 +323,7 @@ class Memory(object):
|
|||
def gotPersonalKey(personal_key):
|
||||
"""Create the session for this profile and store the personal key"""
|
||||
self.auth_sessions.newSession({C.MEMORY_CRYPTO_KEY: personal_key}, profile=profile)
|
||||
log.debug('auth session created for profile %s' % profile)
|
||||
log.debug(u'auth session created for profile %s' % profile)
|
||||
|
||||
d = PersistentDict(C.MEMORY_CRYPTO_NAMESPACE, profile).load()
|
||||
d.addCallback(lambda data: BlockCipher.decrypt(key, data[C.MEMORY_CRYPTO_KEY]))
|
||||
|
|
@ -337,7 +337,7 @@ class Memory(object):
|
|||
try:
|
||||
del self._entities_cache[profile]
|
||||
except KeyError:
|
||||
log.error(_("Trying to purge roster status cache for a profile not in memory: [%s]") % profile)
|
||||
log.error(_(u"Trying to purge roster status cache for a profile not in memory: [%s]") % profile)
|
||||
|
||||
def getProfilesList(self):
|
||||
return self.storage.getProfilesList()
|
||||
|
|
@ -495,7 +495,7 @@ class Memory(object):
|
|||
try:
|
||||
presence_data = self.getEntityDatum(full_jid, "presence", profile_key)
|
||||
except KeyError:
|
||||
log.debug("Can't get presence data for {}".format(full_jid))
|
||||
log.debug(u"Can't get presence data for {}".format(full_jid))
|
||||
else:
|
||||
if presence_data.show != C.PRESENCE_UNAVAILABLE:
|
||||
available.append(resource)
|
||||
|
|
@ -527,13 +527,13 @@ class Memory(object):
|
|||
try:
|
||||
presence_data = self.getEntityDatum(full_jid, "presence", profile_key)
|
||||
except KeyError:
|
||||
log.debug("No presence information for {}".format(full_jid))
|
||||
log.debug(u"No presence information for {}".format(full_jid))
|
||||
continue
|
||||
priority_resources.append((resource, presence_data.priority))
|
||||
try:
|
||||
return max(priority_resources, key=lambda res_tuple: res_tuple[1])[0]
|
||||
except ValueError:
|
||||
log.warning("No resource found at all for {}".format(entity_jid))
|
||||
log.warning(u"No resource found at all for {}".format(entity_jid))
|
||||
return None
|
||||
|
||||
## Entities data ##
|
||||
|
|
@ -801,7 +801,7 @@ class Memory(object):
|
|||
return d.addCallback(cb)
|
||||
|
||||
def done(dummy):
|
||||
log.debug(_('Personal data (%(ns)s, %(key)s) has been successfuly encrypted') %
|
||||
log.debug(_(u'Personal data (%(ns)s, %(key)s) has been successfuly encrypted') %
|
||||
{'ns': C.MEMORY_CRYPTO_NAMESPACE, 'key': data_key})
|
||||
|
||||
d = PersistentDict(C.MEMORY_CRYPTO_NAMESPACE, profile).load()
|
||||
|
|
@ -887,6 +887,6 @@ class Memory(object):
|
|||
try:
|
||||
presence_data = self.getEntityDatum(entity_jid, "presence", profile_key)
|
||||
except KeyError:
|
||||
log.debug("No presence information for {}".format(entity_jid))
|
||||
log.debug(u"No presence information for {}".format(entity_jid))
|
||||
return False
|
||||
return presence_data.show != C.PRESENCE_UNAVAILABLE
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ class Params(object):
|
|||
try:
|
||||
del self.params[profile]
|
||||
except KeyError:
|
||||
log.error(_("Trying to purge cache of a profile not in memory: [%s]") % profile)
|
||||
log.error(_(u"Trying to purge cache of a profile not in memory: [%s]") % profile)
|
||||
|
||||
def save_xml(self, filename):
|
||||
"""Save parameters template to xml file"""
|
||||
|
|
@ -202,7 +202,7 @@ class Params(object):
|
|||
elif return_profile_keys and profile_key in ["@ALL@"]:
|
||||
return profile_key # this value must be managed by the caller
|
||||
if not self.storage.hasProfile(profile_key):
|
||||
log.error(_('Trying to access an unknown profile (%s)') % profile_key)
|
||||
log.error(_(u'Trying to access an unknown profile (%s)') % profile_key)
|
||||
return "" # FIXME: raise exceptions.ProfileUnknownError here (must be well checked, this method is used in lot of places)
|
||||
return profile_key
|
||||
|
||||
|
|
@ -283,23 +283,23 @@ class Params(object):
|
|||
@param app: name of the frontend registering the parameters
|
||||
"""
|
||||
if not app:
|
||||
log.warning(_("Trying to register frontends parameters with no specified app: aborted"))
|
||||
log.warning(_(u"Trying to register frontends parameters with no specified app: aborted"))
|
||||
return
|
||||
if not hasattr(self, "frontends_cache"):
|
||||
self.frontends_cache = []
|
||||
if app in self.frontends_cache:
|
||||
log.debug(_("Trying to register twice frontends parameters for %(app)s: aborted" % {"app": app}))
|
||||
log.debug(_(u"Trying to register twice frontends parameters for %(app)s: aborted" % {"app": app}))
|
||||
return
|
||||
self.frontends_cache.append(app)
|
||||
self.updateParams(xml, security_limit, app)
|
||||
log.debug("Frontends parameters registered for %(app)s" % {'app': app})
|
||||
log.debug(u"Frontends parameters registered for %(app)s" % {'app': app})
|
||||
|
||||
def __default_ok(self, value, name, category):
|
||||
#FIXME: will not work with individual parameters
|
||||
self.setParam(name, value, category)
|
||||
|
||||
def __default_ko(self, failure, name, category):
|
||||
log.error(_("Can't determine default value for [%(category)s/%(name)s]: %(reason)s") % {'category': category, 'name': name, 'reason': str(failure.value)})
|
||||
log.error(_(u"Can't determine default value for [%(category)s/%(name)s]: %(reason)s") % {'category': category, 'name': name, 'reason': str(failure.value)})
|
||||
|
||||
def setDefault(self, name, category, callback, errback=None):
|
||||
"""Set default value of parameter
|
||||
|
|
@ -314,7 +314,7 @@ class Params(object):
|
|||
log.debug ("setDefault called for %(category)s/%(name)s" % {"category": category, "name": name})
|
||||
node = self._getParamNode(name, category, '@ALL@')
|
||||
if not node:
|
||||
log.error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category})
|
||||
log.error(_(u"Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category})
|
||||
return
|
||||
if node[1].getAttribute('default_cb') == 'yes':
|
||||
# del node[1].attributes['default_cb'] # default_cb is not used anymore as a flag to know if we have to set the default value,
|
||||
|
|
@ -354,9 +354,9 @@ class Params(object):
|
|||
{'cat': cat, 'param': param, 'value': value_to_use})
|
||||
return value_to_use
|
||||
if len(selected) == 0:
|
||||
log.error(_('Parameter (%(cat)s, %(param)s) of type list has no default option!') % {'cat': cat, 'param': param})
|
||||
log.error(_(u'Parameter (%(cat)s, %(param)s) of type list has no default option!') % {'cat': cat, 'param': param})
|
||||
else:
|
||||
log.error(_('Parameter (%(cat)s, %(param)s) of type list has more than one default option!') % {'cat': cat, 'param': param})
|
||||
log.error(_(u'Parameter (%(cat)s, %(param)s) of type list has more than one default option!') % {'cat': cat, 'param': param})
|
||||
raise exceptions.DataError
|
||||
return value_to_use
|
||||
return node.getAttribute(attr)
|
||||
|
|
@ -432,7 +432,7 @@ class Params(object):
|
|||
#FIXME: looks really dirty and buggy, need to be reviewed/refactored
|
||||
node = self._getParamNode(name, category)
|
||||
if not node:
|
||||
log.error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category})
|
||||
log.error(_(u"Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category})
|
||||
raise exceptions.NotFound
|
||||
|
||||
if attr == 'value' and node[1].getAttribute('type') == 'password':
|
||||
|
|
@ -472,11 +472,11 @@ class Params(object):
|
|||
"""
|
||||
node = self._getParamNode(name, category)
|
||||
if not node:
|
||||
log.error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category})
|
||||
log.error(_(u"Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name': name, 'category': category})
|
||||
raise ValueError("Requested param doesn't exist")
|
||||
|
||||
if not self.checkSecurityLimit(node[1], security_limit):
|
||||
log.warning(_("Trying to get parameter '%(param)s' in category '%(cat)s' without authorization!!!"
|
||||
log.warning(_(u"Trying to get parameter '%(param)s' in category '%(cat)s' without authorization!!!"
|
||||
% {'param': name, 'cat': category}))
|
||||
raise exceptions.PermissionError
|
||||
|
||||
|
|
@ -736,17 +736,17 @@ class Params(object):
|
|||
if profile_key != C.PROF_KEY_NONE:
|
||||
profile = self.getProfileName(profile_key)
|
||||
if not profile:
|
||||
log.error(_('Trying to set parameter for an unknown profile'))
|
||||
log.error(_(u'Trying to set parameter for an unknown profile'))
|
||||
raise exceptions.ProfileUnknownError
|
||||
|
||||
node = self._getParamNode(name, category, '@ALL@')
|
||||
if not node:
|
||||
log.error(_('Requesting an unknown parameter (%(category)s/%(name)s)')
|
||||
log.error(_(u'Requesting an unknown parameter (%(category)s/%(name)s)')
|
||||
% {'category': category, 'name': name})
|
||||
return defer.succeed(None)
|
||||
|
||||
if not self.checkSecurityLimit(node[1], security_limit):
|
||||
log.warning(_("Trying to set parameter '%(param)s' in category '%(cat)s' without authorization!!!"
|
||||
log.warning(_(u"Trying to set parameter '%(param)s' in category '%(cat)s' without authorization!!!"
|
||||
% {'param': name, 'cat': category}))
|
||||
return defer.succeed(None)
|
||||
|
||||
|
|
@ -758,7 +758,7 @@ class Params(object):
|
|||
try:
|
||||
int(value)
|
||||
except ValueError:
|
||||
log.debug(_("Trying to set parameter '%(param)s' in category '%(cat)s' with an non-integer value"
|
||||
log.debug(_(u"Trying to set parameter '%(param)s' in category '%(cat)s' with an non-integer value"
|
||||
% {'param': name, 'cat': category}))
|
||||
return defer.succeed(None)
|
||||
if node[1].hasAttribute("constraint"):
|
||||
|
|
@ -786,7 +786,7 @@ class Params(object):
|
|||
|
||||
d_list = []
|
||||
if type_ == "button":
|
||||
log.debug("Clicked param button %s" % node.toxml())
|
||||
log.debug(u"Clicked param button %s" % node.toxml())
|
||||
return defer.succeed(None)
|
||||
d = defer.succeed(value)
|
||||
if type_ == "password":
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ class SqliteStorage(object):
|
|||
|
||||
if statements is None:
|
||||
return defer.succeed(None)
|
||||
log.debug("===== COMMITING STATEMENTS =====\n%s\n============\n\n" % '\n'.join(statements))
|
||||
log.debug(u"===== COMMITING STATEMENTS =====\n%s\n============\n\n" % '\n'.join(statements))
|
||||
d = self.dbpool.runInteraction(self._updateDb, tuple(statements))
|
||||
return d
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ class SqliteStorage(object):
|
|||
@param name: name of the profile
|
||||
@return: deferred triggered once profile is actually deleted"""
|
||||
def deletionError(failure):
|
||||
log.error(_("Can't delete profile [%s]") % name)
|
||||
log.error(_(u"Can't delete profile [%s]") % name)
|
||||
return failure
|
||||
|
||||
def delete(txn):
|
||||
|
|
@ -194,7 +194,7 @@ class SqliteStorage(object):
|
|||
for param in result:
|
||||
category, name, value = param
|
||||
params_gen[(category, name)] = value
|
||||
log.debug(_("loading general parameters from database"))
|
||||
log.debug(_(u"loading general parameters from database"))
|
||||
return self.dbpool.runQuery("SELECT category,name,value FROM param_gen").addCallback(fillParams)
|
||||
|
||||
def loadIndParams(self, params_ind, profile):
|
||||
|
|
@ -207,7 +207,7 @@ class SqliteStorage(object):
|
|||
for param in result:
|
||||
category, name, value = param
|
||||
params_ind[(category, name)] = value
|
||||
log.debug(_("loading individual parameters from database"))
|
||||
log.debug(_(u"loading individual parameters from database"))
|
||||
d = self.dbpool.runQuery("SELECT category,name,value FROM param_ind WHERE profile_id=?", (self.profiles[profile], ))
|
||||
d.addCallback(fillParams)
|
||||
return d
|
||||
|
|
@ -229,7 +229,7 @@ class SqliteStorage(object):
|
|||
@param value: value to set
|
||||
@return: deferred"""
|
||||
d = self.dbpool.runQuery("REPLACE INTO param_gen(category,name,value) VALUES (?,?,?)", (category, name, value))
|
||||
d.addErrback(lambda ignore: log.error(_("Can't set general parameter (%(category)s/%(name)s) in database" % {"category": category, "name": name})))
|
||||
d.addErrback(lambda ignore: log.error(_(u"Can't set general parameter (%(category)s/%(name)s) in database" % {"category": category, "name": name})))
|
||||
return d
|
||||
|
||||
def setIndParam(self, category, name, value, profile):
|
||||
|
|
@ -240,7 +240,7 @@ class SqliteStorage(object):
|
|||
@param profile: a profile which *must* exist
|
||||
@return: deferred"""
|
||||
d = self.dbpool.runQuery("REPLACE INTO param_ind(category,name,profile_id,value) VALUES (?,?,?,?)", (category, name, self.profiles[profile], value))
|
||||
d.addErrback(lambda ignore: log.error(_("Can't set individual parameter (%(category)s/%(name)s) for [%(profile)s] in database" % {"category": category, "name": name, "profile": profile})))
|
||||
d.addErrback(lambda ignore: log.error(_(u"Can't set individual parameter (%(category)s/%(name)s) for [%(profile)s] in database" % {"category": category, "name": name, "profile": profile})))
|
||||
return d
|
||||
|
||||
#History
|
||||
|
|
@ -260,7 +260,7 @@ class SqliteStorage(object):
|
|||
d = self.dbpool.runQuery("INSERT INTO history(source, source_res, dest, dest_res, timestamp, message, type, extra, profile_id) VALUES (?,?,?,?,?,?,?,?,?)",
|
||||
(from_jid.userhost(), from_jid.resource, to_jid.userhost(), to_jid.resource, timestamp or time(),
|
||||
message, _type, extra_, self.profiles[profile]))
|
||||
d.addErrback(lambda ignore: log.error(_("Can't save following message in history: from [%(from_jid)s] to [%(to_jid)s] ==> [%(message)s]" %
|
||||
d.addErrback(lambda ignore: log.error(_(u"Can't save following message in history: from [%(from_jid)s] to [%(to_jid)s] ==> [%(message)s]" %
|
||||
{"from_jid": from_jid.full(), "to_jid": to_jid.full(), "message": message})))
|
||||
return d
|
||||
|
||||
|
|
@ -337,9 +337,9 @@ class SqliteStorage(object):
|
|||
for private in result:
|
||||
key, value = private
|
||||
private_gen[key] = value
|
||||
log.debug(_("loading general private values [namespace: %s] from database") % (namespace, ))
|
||||
log.debug(_(u"loading general private values [namespace: %s] from database") % (namespace,))
|
||||
d = self.dbpool.runQuery("SELECT key,value FROM private_gen WHERE namespace=?", (namespace, )).addCallback(fillPrivates)
|
||||
return d.addErrback(lambda x: log.debug(_("No data present in database for namespace %s") % namespace))
|
||||
return d.addErrback(lambda x: log.debug(_(u"No data present in database for namespace %s") % namespace))
|
||||
|
||||
def loadIndPrivates(self, private_ind, namespace, profile):
|
||||
"""Load individual private values
|
||||
|
|
@ -352,10 +352,10 @@ class SqliteStorage(object):
|
|||
for private in result:
|
||||
key, value = private
|
||||
private_ind[key] = value
|
||||
log.debug(_("loading individual private values [namespace: %s] from database") % (namespace, ))
|
||||
log.debug(_(u"loading individual private values [namespace: %s] from database") % (namespace,))
|
||||
d = self.dbpool.runQuery("SELECT key,value FROM private_ind WHERE namespace=? AND profile_id=?", (namespace, self.profiles[profile]))
|
||||
d.addCallback(fillPrivates)
|
||||
return d.addErrback(lambda x: log.debug(_("No data present in database for namespace %s") % namespace))
|
||||
return d.addErrback(lambda x: log.debug(_(u"No data present in database for namespace %s") % namespace))
|
||||
|
||||
def setGenPrivate(self, namespace, key, value):
|
||||
"""Save the general private value in database
|
||||
|
|
@ -364,7 +364,7 @@ class SqliteStorage(object):
|
|||
@param value: value to set
|
||||
@return: deferred"""
|
||||
d = self.dbpool.runQuery("REPLACE INTO private_gen(namespace,key,value) VALUES (?,?,?)", (namespace, key, value))
|
||||
d.addErrback(lambda ignore: log.error(_("Can't set general private value (%(key)s) [namespace:%(namespace)s] in database" %
|
||||
d.addErrback(lambda ignore: log.error(_(u"Can't set general private value (%(key)s) [namespace:%(namespace)s] in database" %
|
||||
{"namespace": namespace, "key": key})))
|
||||
return d
|
||||
|
||||
|
|
@ -376,7 +376,7 @@ class SqliteStorage(object):
|
|||
@param profile: a profile which *must* exist
|
||||
@return: deferred"""
|
||||
d = self.dbpool.runQuery("REPLACE INTO private_ind(namespace,key,profile_id,value) VALUES (?,?,?,?)", (namespace, key, self.profiles[profile], value))
|
||||
d.addErrback(lambda ignore: log.error(_("Can't set individual private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" %
|
||||
d.addErrback(lambda ignore: log.error(_(u"Can't set individual private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" %
|
||||
{"namespace": namespace, "key": key, "profile": profile})))
|
||||
return d
|
||||
|
||||
|
|
@ -386,7 +386,7 @@ class SqliteStorage(object):
|
|||
@param key: key of the private value
|
||||
@return: deferred"""
|
||||
d = self.dbpool.runQuery("DELETE FROM private_gen WHERE namespace=? AND key=?", (namespace, key))
|
||||
d.addErrback(lambda ignore: log.error(_("Can't delete general private value (%(key)s) [namespace:%(namespace)s] in database" %
|
||||
d.addErrback(lambda ignore: log.error(_(u"Can't delete general private value (%(key)s) [namespace:%(namespace)s] in database" %
|
||||
{"namespace": namespace, "key": key})))
|
||||
return d
|
||||
|
||||
|
|
@ -397,7 +397,7 @@ class SqliteStorage(object):
|
|||
@param profile: a profile which *must* exist
|
||||
@return: deferred"""
|
||||
d = self.dbpool.runQuery("DELETE FROM private_ind WHERE namespace=? AND key=? AND profile=?)", (namespace, key, self.profiles[profile]))
|
||||
d.addErrback(lambda ignore: log.error(_("Can't delete individual private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" %
|
||||
d.addErrback(lambda ignore: log.error(_(u"Can't delete individual private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" %
|
||||
{"namespace": namespace, "key": key, "profile": profile})))
|
||||
return d
|
||||
|
||||
|
|
@ -411,9 +411,9 @@ class SqliteStorage(object):
|
|||
for private in result:
|
||||
key, value = private
|
||||
private_gen[key] = pickle.loads(str(value))
|
||||
log.debug(_("loading general private binary values [namespace: %s] from database") % (namespace, ))
|
||||
log.debug(_(u"loading general private binary values [namespace: %s] from database") % (namespace,))
|
||||
d = self.dbpool.runQuery("SELECT key,value FROM private_gen_bin WHERE namespace=?", (namespace, )).addCallback(fillPrivates)
|
||||
return d.addErrback(lambda x: log.debug(_("No binary data present in database for namespace %s") % namespace))
|
||||
return d.addErrback(lambda x: log.debug(_(u"No binary data present in database for namespace %s") % namespace))
|
||||
|
||||
def loadIndPrivatesBinary(self, private_ind, namespace, profile):
|
||||
"""Load individual private binary values
|
||||
|
|
@ -426,10 +426,10 @@ class SqliteStorage(object):
|
|||
for private in result:
|
||||
key, value = private
|
||||
private_ind[key] = pickle.loads(str(value))
|
||||
log.debug(_("loading individual private binary values [namespace: %s] from database") % (namespace, ))
|
||||
log.debug(_(u"loading individual private binary values [namespace: %s] from database") % (namespace,))
|
||||
d = self.dbpool.runQuery("SELECT key,value FROM private_ind_bin WHERE namespace=? AND profile_id=?", (namespace, self.profiles[profile]))
|
||||
d.addCallback(fillPrivates)
|
||||
return d.addErrback(lambda x: log.debug(_("No binary data present in database for namespace %s") % namespace))
|
||||
return d.addErrback(lambda x: log.debug(_(u"No binary data present in database for namespace %s") % namespace))
|
||||
|
||||
def setGenPrivateBinary(self, namespace, key, value):
|
||||
"""Save the general private binary value in database
|
||||
|
|
@ -438,7 +438,7 @@ class SqliteStorage(object):
|
|||
@param value: value to set
|
||||
@return: deferred"""
|
||||
d = self.dbpool.runQuery("REPLACE INTO private_gen_bin(namespace,key,value) VALUES (?,?,?)", (namespace, key, pickle.dumps(value, 0)))
|
||||
d.addErrback(lambda ignore: log.error(_("Can't set general private binary value (%(key)s) [namespace:%(namespace)s] in database" %
|
||||
d.addErrback(lambda ignore: log.error(_(u"Can't set general private binary value (%(key)s) [namespace:%(namespace)s] in database" %
|
||||
{"namespace": namespace, "key": key})))
|
||||
return d
|
||||
|
||||
|
|
@ -450,7 +450,7 @@ class SqliteStorage(object):
|
|||
@param profile: a profile which *must* exist
|
||||
@return: deferred"""
|
||||
d = self.dbpool.runQuery("REPLACE INTO private_ind_bin(namespace,key,profile_id,value) VALUES (?,?,?,?)", (namespace, key, self.profiles[profile], pickle.dumps(value, 0)))
|
||||
d.addErrback(lambda ignore: log.error(_("Can't set individual binary private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" %
|
||||
d.addErrback(lambda ignore: log.error(_(u"Can't set individual binary private value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" %
|
||||
{"namespace": namespace, "key": key, "profile": profile})))
|
||||
return d
|
||||
|
||||
|
|
@ -460,7 +460,7 @@ class SqliteStorage(object):
|
|||
@param key: key of the private value
|
||||
@return: deferred"""
|
||||
d = self.dbpool.runQuery("DELETE FROM private_gen_bin WHERE namespace=? AND key=?", (namespace, key))
|
||||
d.addErrback(lambda ignore: log.error(_("Can't delete general private binary value (%(key)s) [namespace:%(namespace)s] in database" %
|
||||
d.addErrback(lambda ignore: log.error(_(u"Can't delete general private binary value (%(key)s) [namespace:%(namespace)s] in database" %
|
||||
{"namespace": namespace, "key": key})))
|
||||
return d
|
||||
|
||||
|
|
@ -471,7 +471,7 @@ class SqliteStorage(object):
|
|||
@param profile: a profile which *must* exist
|
||||
@return: deferred"""
|
||||
d = self.dbpool.runQuery("DELETE FROM private_ind_bin WHERE namespace=? AND key=? AND profile=?)", (namespace, key, self.profiles[profile]))
|
||||
d.addErrback(lambda ignore: log.error(_("Can't delete individual private binary value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" %
|
||||
d.addErrback(lambda ignore: log.error(_(u"Can't delete individual private binary value (%(key)s) [namespace: %(namespace)s] for [%(profile)s] in database" %
|
||||
{"namespace": namespace, "key": key, "profile": profile})))
|
||||
return d
|
||||
##Helper methods##
|
||||
|
|
@ -781,7 +781,7 @@ class Updater(object):
|
|||
try:
|
||||
id_ = result[0][0]
|
||||
except IndexError:
|
||||
log.error("Profile of id %d is referenced in 'param_ind' but it doesn't exist!" % profile_id)
|
||||
log.error(u"Profile of id %d is referenced in 'param_ind' but it doesn't exist!" % profile_id)
|
||||
return defer.succeed(None)
|
||||
|
||||
sat_password = xmpp_password
|
||||
|
|
|
|||
Loading…
Reference in a new issue