refactor: factorize Model.__html__

This commit is contained in:
Éloi Rivard 2024-04-07 20:23:43 +02:00
parent 702eec7aca
commit fecfcfa8f3
No known key found for this signature in database
GPG key ID: 7EDA204EA57DD184
4 changed files with 3 additions and 9 deletions

View file

@ -139,9 +139,6 @@ class LDAPObject(BackendModel, metaclass=LDAPObjectMetaclass):
def identifier_attribute(cls):
return cls.rdn_attribute
def __html__(self):
return self.id
def __eq__(self, other):
ldap_attributes = self.may() + self.must()

View file

@ -233,9 +233,6 @@ class MemoryModel(BackendModel):
else:
super().__setattr__(name, value)
def __html__(self):
return self.id
@property
def identifier(self):
return getattr(self, self.identifier_attribute)

View file

@ -195,3 +195,6 @@ class BackendModel:
getattr(self, attribute) and value in getattr(self, attribute)
for attribute, value in filter.items()
)
def __html__(self):
return self.id

View file

@ -31,9 +31,6 @@ force_auto_coercion()
class SqlAlchemyModel(BackendModel):
def __html__(self):
return self.id
def __repr__(self):
return (
f"<{self.__class__.__name__} {self.identifier_attribute}={self.identifier}>"