forked from Github-Mirrors/canaille
refactor: factorize Model.__html__
This commit is contained in:
parent
702eec7aca
commit
fecfcfa8f3
4 changed files with 3 additions and 9 deletions
|
@ -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()
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}>"
|
||||
|
|
Loading…
Reference in a new issue