Unverified Commit f5875d06 authored by Peter Stanko's avatar Peter Stanko
Browse files

fixes in the repr

parent 217ef570
Pipeline #13276 passed with stage
in 25 minutes and 33 seconds
......@@ -31,12 +31,14 @@ def _repr(instance) -> str:
Returns(str): String representation of the model
"""
no_include = {'password_hash', 'review', 'course', 'user', 'project', 'group', 'role',
'review_items'}
'review_items', 'client', 'EXCLUDED'}
if 'EXCLUDED' in vars(instance.__class__):
no_include.update(instance.__class__.EXCLUDED)
result = f"{instance.__class__.__name__}: "
for key, value in vars(instance).items():
for key in dir(instance):
if not key.startswith("_") and key not in no_include:
value = getattr(instance, key)
if not callable(value):
result += f"{key}={value} "
return result
......@@ -142,13 +144,13 @@ class Client(db.Model):
return self.id == eid
class Secret(db.Model):
class Secret(db.Model, EntityBase):
__tablename__ = 'secret'
EXCLUDED = ['value', 'client']
id = db.Column(db.String(length=36), default=lambda: str(
uuid.uuid4()), primary_key=True)
name = db.Column(db.String(40), nullable=False)
value = db.Column(db.String(120))
created_at = db.Column(db.TIMESTAMP, default=db.func.now())
expires_at = db.Column(db.TIMESTAMP, nullable=True)
client_id = db.Column(db.String(36), db.ForeignKey(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment