diff sat/plugins/plugin_comp_ap_gateway/__init__.py @ 3853:a56d5ad466b3

component AP gateway: fix wrong exception + use of mb_data["xml"] when it may be absent
author Goffi <goffi@goffi.org>
date Thu, 14 Jul 2022 12:55:30 +0200
parents 384ad98ea9fe
children 54305ebf5b94
line wrap: on
line diff
--- a/sat/plugins/plugin_comp_ap_gateway/__init__.py	Thu Jul 14 12:55:30 2022 +0200
+++ b/sat/plugins/plugin_comp_ap_gateway/__init__.py	Thu Jul 14 12:55:30 2022 +0200
@@ -1404,7 +1404,7 @@
             Can be either an activity of an object
         @return: AP Item's Object and microblog data
         @raise exceptions.DataError: something is invalid in the AP item
-        @raise NotImplemented: some AP data is not handled yet
+        @raise NotImplementedError: some AP data is not handled yet
         @raise error.StanzaError: error while contacting the AP server
         """
         is_activity = self.isActivity(ap_item)
@@ -1751,14 +1751,14 @@
         if client != self.client:
             return mess_data
         if mess_data["type"] not in ("chat", "normal"):
-            log.warning(f"ignoring message with unexpected type: {mess_data['xml'].toXml()}")
+            log.warning(f"ignoring message with unexpected type: {mess_data}")
             return mess_data
         if not self.isLocal(mess_data["from"]):
-            log.warning(f"ignoring non local message: {mess_data['xml'].toXml()}")
+            log.warning(f"ignoring non local message: {mess_data}")
             return mess_data
         if not mess_data["to"].user:
             log.warning(
-                f"ignoring message addressed to gateway itself: {mess_data['xml'].toXml()}"
+                f"ignoring message addressed to gateway itself: {mess_data}"
             )
             return mess_data
 
@@ -1967,7 +1967,7 @@
             # we don't have a comment node set for this item
             from sat.tools.xml_tools import ppElt
             log.info(f"{ppElt(parent_item_elt.toXml())}")
-            raise NotImplemented()
+            raise NotImplementedError()
         else:
             __, item_elt = await self.apItem2MbDataAndElt(ap_item)
             await self._p.publish(client, comment_service, comment_node, [item_elt])