From 243eba2f78baf8fa5f5fdc8faacd157b4f0646f0 Mon Sep 17 00:00:00 2001
From: Stephan Porada <sporada@uni-bielefeld.de>
Date: Mon, 18 May 2020 11:59:19 +0200
Subject: [PATCH] Add new __repr__ function.

---
 app/models.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/app/models.py b/app/models.py
index 91955841..02f6f879 100644
--- a/app/models.py
+++ b/app/models.py
@@ -50,7 +50,7 @@ class Role(db.Model):
         '''
         String representation of the Role. For human readability.
         '''
-        return '<Role %r>' % self.name
+        return '<Role {role_name}>'.format(role_name=self.name)
 
     def add_permission(self, perm):
         '''
@@ -151,7 +151,7 @@ class User(UserMixin, db.Model):
         '''
         String representation of the User. For human readability.
         '''
-        return '<User %r>' % self.username
+        return '<User {username}>'.format(username=self.username)
 
     def __init__(self, **kwargs):
         super(User, self).__init__(**kwargs)
@@ -278,7 +278,7 @@ class JobInput(db.Model):
         '''
         String representation of the JobInput. For human readability.
         '''
-        return '<JobInput %r>' % self.filename
+        return '<JobInput {filename}>'.format(filename=self.filename)
 
     def to_dict(self):
         return {'id': self.id,
@@ -303,7 +303,7 @@ class JobResult(db.Model):
         '''
         String representation of the JobResult. For human readability.
         '''
-        return '<JobResult %r>' % self.filename
+        return '<JobResult {filename}>'.format(filename=self.filename)
 
     def to_dict(self):
         return {'id': self.id,
@@ -353,7 +353,7 @@ class Job(db.Model):
         '''
         String representation of the Job. For human readability.
         '''
-        return '<Job %r>' % self.title
+        return '<Job {job_title}>'.format(job_title=self.title)
 
     def create_secure_filename(self):
         '''
@@ -410,7 +410,7 @@ class NotificationData(db.Model):
         '''
         String representation of the NotificationData. For human readability.
         '''
-        return '<NotificationData %r>' % self.id  # TODO: Why not .format()?
+        return '<NotificationData {id}>'.format(id=self.id)
 
     def to_dict(self):
         return {'id': self.id,
@@ -537,7 +537,7 @@ class Corpus(db.Model):
         '''
         String representation of the corpus. For human readability.
         '''
-        return '<Corpus %r>' % self.title
+        return '<Corpus {corpus_title}>'.format(corpus_title=self.title)
 
 
 '''
-- 
GitLab