Merge pull request #16476 from resilient-tech/better-repr

This commit is contained in:
Suraj Shetty 2022-04-01 10:51:32 +05:30 committed by GitHub
commit beb84ffb2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1378,11 +1378,9 @@ class Document(BaseDocument):
doctype = self.__class__.__name__
docstatus = f" docstatus={self.docstatus}" if self.docstatus else ""
repr_str = f"<{doctype}: {name}{docstatus}"
parent = f" parent={self.parent}" if getattr(self, "parent", None) else ""
if not hasattr(self, "parent"):
return repr_str + ">"
return f"{repr_str} parent={self.parent}>"
return f"<{doctype}: {name}{docstatus}{parent}>"
def __str__(self):
name = self.name or "unsaved"