changeset 74a6b2213993 in proteus:default
details: https://hg.tryton.org/proteus?cmd=changeset;node=74a6b2213993
description:
        Use same __str__ as trytond instances

        issue9053
        review291081002
diffstat:

 CHANGELOG           |  2 ++
 proteus/__init__.py |  7 +++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 5be4ecbcb691 -r 74a6b2213993 CHANGELOG
--- a/CHANGELOG Sun Mar 01 12:33:54 2020 +0100
+++ b/CHANGELOG Fri Mar 06 23:55:34 2020 +0100
@@ -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 -r 5be4ecbcb691 -r 74a6b2213993 proteus/__init__.py
--- a/proteus/__init__.py       Sun Mar 01 12:33:54 2020 +0100
+++ b/proteus/__init__.py       Fri Mar 06 23:55:34 2020 +0100
@@ -57,7 +57,8 @@
     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 @@
                 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 @@
                     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):

Reply via email to