Ensuring model's have a basic __repr__. (#499)
This commit is contained in:
parent
9eddaf66cb
commit
e9219adfb5
@ -159,6 +159,9 @@ class Certificate(db.Model):
|
||||
"""
|
||||
return "arn:aws:iam::{}:server-certificate/{}".format(account_number, self.name)
|
||||
|
||||
def __repr__(self):
|
||||
return "Certificate(name={name})".format(name=self.name)
|
||||
|
||||
|
||||
@event.listens_for(Certificate.destinations, 'append')
|
||||
def update_destinations(target, value, initiator):
|
||||
|
@ -23,3 +23,6 @@ class Destination(db.Model):
|
||||
@property
|
||||
def plugin(self):
|
||||
return plugins.get(self.plugin_name)
|
||||
|
||||
def __repr__(self):
|
||||
return "Destination(label={label})".format(label=self.label)
|
||||
|
@ -17,3 +17,6 @@ class Domain(db.Model):
|
||||
id = Column(Integer, primary_key=True)
|
||||
name = Column(String(256))
|
||||
sensitive = Column(Boolean, default=False)
|
||||
|
||||
def __repr__(self):
|
||||
return "Domain(name={name})".format(name=self.name)
|
||||
|
@ -81,3 +81,6 @@ class Endpoint(db.Model):
|
||||
issues.append({'name': 'revoked', 'value': 'There is a revoked certificate attached to this endpoint consider replacing it.'})
|
||||
|
||||
return issues
|
||||
|
||||
def __repr__(self):
|
||||
return "Endpoint(name={name})".format(name=self.name)
|
||||
|
@ -33,3 +33,6 @@ class Notification(db.Model):
|
||||
@property
|
||||
def plugin(self):
|
||||
return plugins.get(self.plugin_name)
|
||||
|
||||
def __repr__(self):
|
||||
return "Notification(label={label})".format(label=self.label)
|
||||
|
@ -29,3 +29,6 @@ class Role(db.Model):
|
||||
user_id = Column(Integer, ForeignKey('users.id'))
|
||||
users = relationship("User", secondary=roles_users, passive_deletes=True, backref="role")
|
||||
certificates = relationship("Certificate", secondary=roles_certificates, backref="role")
|
||||
|
||||
def __repr__(self):
|
||||
return "Role(name={name})".format(name=self.name)
|
||||
|
@ -27,3 +27,6 @@ class Source(db.Model):
|
||||
@property
|
||||
def plugin(self):
|
||||
return plugins.get(self.plugin_name)
|
||||
|
||||
def __repr__(self):
|
||||
return "Source(label={label})".format(label=self.label)
|
||||
|
@ -81,5 +81,8 @@ class User(db.Model):
|
||||
if role.name == 'admin':
|
||||
return True
|
||||
|
||||
def __repr__(self):
|
||||
return "User(username={username})".format(username=self.username)
|
||||
|
||||
|
||||
listen(User, 'before_insert', hash_password)
|
||||
|
Loading…
Reference in New Issue
Block a user