diff sat/plugins/plugin_xep_0363.py @ 3040:fee60f17ebac

jp: jp asyncio port: /!\ this commit is huge. Jp is temporarily not working with `dbus` bridge /!\ This patch implements the port of jp to asyncio, so it is now correctly using the bridge asynchronously, and it can be used with bridges like `pb`. This also simplify the code, notably for things which were previously implemented with many callbacks (like pagination with RSM). During the process, some behaviours have been modified/fixed, in jp and backends, check diff for details.
author Goffi <goffi@goffi.org>
date Wed, 25 Sep 2019 08:56:41 +0200
parents ab2696e34d29
children e75024e41f81
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0363.py	Wed Sep 25 08:53:38 2019 +0200
+++ b/sat/plugins/plugin_xep_0363.py	Wed Sep 25 08:56:41 2019 +0200
@@ -36,7 +36,6 @@
 from twisted.web import iweb
 from twisted.python import failure
 from collections import namedtuple
-from zope.interface import implementer
 from OpenSSL import SSL
 import os.path
 import mimetypes
@@ -204,7 +203,7 @@
         @param ignore_tls_errors(bool): ignore TLS certificate is True
         @return (tuple
         """
-        log.debug("Got upload slot: {}".format(slot))
+        log.debug(f"Got upload slot: {slot}")
         sat_file = self.host.plugins["FILE"].File(
             self.host, client, path, size=size, auto_end_signals=False
         )
@@ -222,7 +221,7 @@
             headers[name] = value
 
         d = agent.request(
-            "PUT",
+            b"PUT",
             slot.put.encode("utf-8"),
             http_headers.Headers(headers),
             file_producer,