source: ralphm-patches/py3-disco.patch

Last change on this file was 78:361e2111a663, checked in by Ralph Meijer <ralphm@…>, 5 years ago

Start port to Python 3.

File size: 2.5 KB
RevLine 
[78]1# HG changeset patch
2# Parent  b7bf25ca839d7ac87cc565a0374110c49de27d18
3
4diff --git a/wokkel/disco.py b/wokkel/disco.py
5--- a/wokkel/disco.py
6+++ b/wokkel/disco.py
7@@ -10,7 +10,10 @@
8 U{XEP-0030<http://xmpp.org/extensions/xep-0030.html>}.
9 """
10 
11+from __future__ import division, absolute_import
12+
13 from twisted.internet import defer
14+from twisted.python.compat import iteritems, unicode
15 from twisted.words.protocols.jabber import error, jid
16 from twisted.words.xish import domish
17 
18@@ -363,7 +366,7 @@
19             NS_DISCO_ITEMS: 'items',
20             }
21 
22-    _verbRequestMap = dict(((v, k) for k, v in _requestVerbMap.iteritems()))
23+    _verbRequestMap = dict(((v, k) for k, v in iteritems(_requestVerbMap)))
24 
25     def __init__(self, verb=None, nodeIdentifier='',
26                        recipient=None, sender=None):
27diff --git a/wokkel/test/test_disco.py b/wokkel/test/test_disco.py
28--- a/wokkel/test/test_disco.py
29+++ b/wokkel/test/test_disco.py
30@@ -5,7 +5,9 @@
31 Tests for L{wokkel.disco}.
32 """
33 
34-from zope.interface import implements
35+from __future__ import division, absolute_import
36+
37+from zope.interface import implementer
38 
39 from twisted.internet import defer
40 from twisted.trial import unittest
41@@ -846,8 +848,8 @@
42                       disco.DiscoFeature('jabber:iq:version')
43         ]
44 
45+        @implementer(disco.IDisco)
46         class DiscoResponder(XMPPHandler):
47-            implements(disco.IDisco)
48 
49             def getDiscoInfo(self, requestor, target, nodeIdentifier):
50                 if not nodeIdentifier:
51@@ -873,8 +875,8 @@
52                       disco.DiscoFeature('jabber:iq:version')
53         ]
54 
55+        @implementer(disco.IDisco)
56         class DiscoResponder(XMPPHandler):
57-            implements(disco.IDisco)
58 
59             def getDiscoInfo(self, requestor, target, nodeIdentifier):
60                 if not nodeIdentifier:
61@@ -897,8 +899,8 @@
62         """
63         discoItems = [disco.DiscoItem(JID('example.com'), 'test', 'Test node')]
64 
65+        @implementer(disco.IDisco)
66         class DiscoResponder(XMPPHandler):
67-            implements(disco.IDisco)
68 
69             def getDiscoItems(self, requestor, target, nodeIdentifier):
70                 if not nodeIdentifier:
71@@ -921,8 +923,8 @@
72         """
73         discoItems = [disco.DiscoItem(JID('example.com'), 'test', 'Test node')]
74 
75+        @implementer(disco.IDisco)
76         class DiscoResponder(XMPPHandler):
77-            implements(disco.IDisco)
78 
79             def getDiscoItems(self, requestor, target, nodeIdentifier):
80                 if not nodeIdentifier:
Note: See TracBrowser for help on using the repository browser.