From 5a5b61ba3a4b656f8f2947b04a4b46769e56a599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 6 Mar 2020 23:55:34 +0100 Subject: [PATCH] Use same __str__ as trytond instances issue9053 review291081002 --- CHANGELOG | 2 ++ proteus/__init__.py | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 079cd4ebb3..2643acc0c4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Use same __str__ as trytond instances + Version 5.4.0 - 2019-11-04 * Bug fixes (see mercurial logs for details) * Support dot notation on PYSON Eval diff --git a/proteus/__init__.py b/proteus/__init__.py index d5b5a4693e..dc2d1ad2ef 100644 --- a/proteus/__init__.py +++ b/proteus/__init__.py @@ -57,7 +57,8 @@ class _EvalEnvironment(dict): def __str__(self): return str(self.parent) - __repr__ = __str__ + def __repr__(self): + return repr(self.parent) def __contains__(self, item): if item == 'id': @@ -772,8 +773,7 @@ class Model(object): del models[name] def __str__(self): - return '<%s(%d)>' % (self.__class__.__name__, self.id) - __str__.__doc__ = object.__str__.__doc__ + return '%s,%d' % (self.__class__.__name__, self.id) def __repr__(self): if self._config == proteus.config.get_config(): @@ -781,7 +781,6 @@ class Model(object): self.id) return "proteus.Model.get('%s', %s)(%d)" % (self.__class__.__name__, repr(self._config), self.id) - __repr__.__doc__ = object.__repr__.__doc__ def __eq__(self, other): if isinstance(other, Model):