From 624ab71cf3cd46e2e43f22e64f2546c95a913a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sun, 18 Jun 2023 19:52:43 +0200 Subject: feat: JID: Add sqlite3 adapter magic method --- nbxmpp/protocol.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nbxmpp/protocol.py b/nbxmpp/protocol.py index ecf233a..48c8e99 100644 --- a/nbxmpp/protocol.py +++ b/nbxmpp/protocol.py @@ -30,6 +30,7 @@ import os import time import hashlib import functools +import sqlite3 import warnings from base64 import b64encode from dataclasses import dataclass @@ -704,6 +705,11 @@ class JID: return f'{jid}/{self.resource}' return jid + def __conform__(self, protocol: sqlite3.PrepareProtocol): + if protocol is sqlite3.PrepareProtocol: + return str(self) + raise ValueError + def __hash__(self): return hash(str(self)) -- cgit v1.2.3