Skip to content

Commit

Permalink
models: logging strings unicode-friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
cenouralm authored and slint committed Jul 26, 2022
1 parent 29b776f commit 46bb6e3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions invenio_pidstore/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def create(cls, pid_type, pid_value, pid_provider=None,
extra={'pid': obj})
except IntegrityError:
logger.exception(
"PID already exists: {0}:{1}".format(pid_type, pid_value),
u"PID already exists: {0}:{1}".format(pid_type, pid_value),
extra=dict(
pid_type=pid_type,
pid_value=pid_value,
Expand All @@ -163,7 +163,7 @@ def create(cls, pid_type, pid_value, pid_provider=None,
raise PIDAlreadyExists(pid_type=pid_type, pid_value=pid_value)
except SQLAlchemyError:
logger.exception(
"Failed to create PID: {0}:{1}".format(pid_type, pid_value),
u"Failed to create PID: {0}:{1}".format(pid_type, pid_value),
extra=dict(
pid_type=pid_type,
pid_value=pid_value,
Expand Down Expand Up @@ -281,7 +281,7 @@ def assign(self, object_type, object_uuid, overwrite=False):
self.object_uuid = object_uuid
db.session.add(self)
except SQLAlchemyError:
logger.exception("Failed to assign {0}:{1}".format(
logger.exception(u"Failed to assign {0}:{1}".format(
object_type, object_uuid), extra=dict(pid=self))
raise
logger.info(u"Assigned object {0}:{1}".format(
Expand Down Expand Up @@ -311,7 +311,7 @@ def unassign(self):
self.object_uuid = None
db.session.add(self)
except SQLAlchemyError:
logger.exception("Failed to unassign object.".format(self),
logger.exception(u"Failed to unassign object.".format(self),
extra=dict(pid=self))
raise
logger.info(u"Unassigned object from {0}.".format(self),
Expand Down Expand Up @@ -360,7 +360,7 @@ def redirect(self, pid):
except IntegrityError:
raise PIDDoesNotExistError(pid.pid_type, pid.pid_value)
except SQLAlchemyError:
logger.exception("Failed to redirect to {0}".format(
logger.exception(u"Failed to redirect to {0}".format(
pid), extra=dict(pid=self))
raise
logger.info(u"Redirected PID to {0}".format(pid), extra=dict(pid=self))
Expand Down Expand Up @@ -460,7 +460,7 @@ def sync_status(self, status):
self.status = status
db.session.add(self)
except SQLAlchemyError:
logger.exception("Failed to sync status {0}.".format(status),
logger.exception(u"Failed to sync status {0}.".format(status),
extra=dict(pid=self))
raise
logger.info(u"Synced PID status to {0}.".format(status),
Expand Down

0 comments on commit 46bb6e3

Please sign in to comment.