changeset 130:3d77f3808bfa

Follow API change in backend. Work around bug in xish.domish.
author Ralph Meijer <ralphm@ik.nu>
date Sun, 24 Apr 2005 17:25:33 +0000
parents 43102fecb14b
children fe8cb99363ff
files idavoll/idavoll.py idavoll/pubsub.py
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/idavoll/idavoll.py	Sun Apr 24 17:24:35 2005 +0000
+++ b/idavoll/idavoll.py	Sun Apr 24 17:25:33 2005 +0000
@@ -1,6 +1,5 @@
 from twisted.words.protocols.jabber import component
 from twisted.application import service
-from twisted.python import components
 from twisted.internet import defer
 import backend
 import pubsub
--- a/idavoll/pubsub.py	Sun Apr 24 17:24:35 2005 +0000
+++ b/idavoll/pubsub.py	Sun Apr 24 17:25:33 2005 +0000
@@ -10,6 +10,13 @@
 import disco
 import data_form
 
+if issubclass(domish.SerializedXML, str):
+    # Work around bug # in twisted Xish
+    class SerializedXML(unicode):
+        """ Marker class for pre-serialized XML in the DOM. """
+
+    domish.SerializedXML = SerializedXML
+
 NS_COMPONENT = 'jabber:component:accept'
 NS_PUBSUB = 'http://jabber.org/protocol/pubsub'
 NS_PUBSUB_EVENT = NS_PUBSUB + '#event'
@@ -60,13 +67,13 @@
 error_map = {
     storage.NodeNotFound: ('item-not-found', None),
     storage.NodeExists: ('conflict', None),
-
+    storage.SubscriptionNotFound: ('not-authorized',
+                                   'not-subscribed'),
     backend.NotAuthorized: ('not-authorized', None),
     backend.NoPayloadAllowed: ('bad-request', None),
     backend.PayloadExpected: ('bad-request', None),
     backend.NoInstantNodes: ('not-acceptable', None),
     backend.NotImplemented: ('feature-not-implemented', None),
-    backend.NotSubscribed: ('not-authorized', 'requestor-not-subscribed'),
     backend.InvalidConfigurationOption: ('not-acceptable', None),
     backend.InvalidConfigurationValue: ('not-acceptable', None),
 }
@@ -115,7 +122,6 @@
         except:
             d = defer.fail()
 
-
         d.addCallback(self.success, iq)
         d.addErrback(self.error, iq)
         d.addCallback(self.send)
@@ -277,7 +283,7 @@
         entity["node"] = result["node"]
         entity["jid"] = subscriber.full()
         entity["affiliation"] = result["affiliation"] or 'none'
-        entity["subscription"] = result["subscription"]
+        entity["subscription"] = result["state"]
         return [reply]
 
     def onUnsubscribe(self, iq):