Projet

Général

Profil

0001-python-Exception.message-was-removed-in-python3-4599.patch

Benjamin Dauvergne, 21 août 2020 11:54

Télécharger (1,97 ko)

Voir les différences:

Subject: [PATCH] python: Exception.message was removed in python3 (#45995)

 bindings/python/lang.py                | 5 ++++-
 bindings/python/tests/binding_tests.py | 8 ++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
bindings/python/lang.py
188 188
        if self.code:
189 189
            return '<lasso.%s(%s): %s>' % (self.__class__.__name__, self.code, _lasso.strError(self.code))
190 190
        else:
191
            return '<lasso.%s: %s>' % (self.__class__.__name__, self.message)
191
            if sys.version_info >= (3,):
192
                return '<lasso.%s: %s>' % (self.__class__.__name__, self)
193
            else:
194
                return '<lasso.%s: %s>' % (self.__class__.__name__, self.message)
192 195

  
193 196
    def __getitem__(self, i):
194 197
        # compatibility with SWIG bindings
bindings/python/tests/binding_tests.py
329 329
        node.sessionIndexes = ()
330 330
        assert node.sessionIndexes == (), node.sessionIndexes
331 331

  
332
    def test14(self):
333
        # verify Error implementation
334
        with self.assertRaises(lasso.Error) as cm:
335
            lasso.Server('', '', '')
336
        assert isinstance(str(cm.exception), str)
337
        with self.assertRaises(lasso.Error) as cm:
338
            lasso.Error.raise_on_rc(lasso._lasso.XML_ERROR_SCHEMA_INVALID_FRAGMENT)
339
        self.assertEqual(str(cm.exception), '<lasso.XmlSchemaInvalidFragmentError(17): An XML tree does not respect at least an XML schema of its namespaces.>')
332 340

  
333 341

  
334 342

  
335
-