diff sat_pubsub/backend.py @ 240:70c8bb90d75f

added access_model to config, default to 'open'
author Goffi <goffi@goffi.org>
date Tue, 22 May 2012 21:21:57 +0200
parents 6596730685e8
children 42048e37699e
line wrap: on
line diff
--- a/sat_pubsub/backend.py	Sun May 20 00:52:13 2012 +0200
+++ b/sat_pubsub/backend.py	Tue May 22 21:21:57 2012 +0200
@@ -70,7 +70,7 @@
 from twisted.python import components, log
 from twisted.internet import defer, reactor
 from twisted.words.protocols.jabber.error import StanzaError
-from twisted.words.protocols.jabber.jid import JID
+from twisted.words.protocols.jabber.jid import JID, InvalidFormat
 from twisted.words.xish import utility
 
 from wokkel import disco
@@ -603,6 +603,7 @@
 
         self.backend.registerNotifier(self._notify)
         self.backend.registerPreDelete(self._preDelete)
+        
         if self.backend.supportsCreatorCheck():
             self.features.append("creator-jid-check")  #SàT custom feature: Check that a node (which correspond to
                                                        #                    a jid in this server) is created by the right jid
@@ -663,7 +664,6 @@
 
         raise exc
 
-
     def getInfo(self, requestor, service, nodeIdentifier):
         info = {}
 
@@ -701,6 +701,7 @@
 
     def _publish_errb(self, failure, request):
         if failure.type == error.NodeNotFound and self.backend.supportsAutoCreate():
+            print "Auto-creating node %s" % (request.nodeIdentifier,)
             d = self.backend.createNode(request.nodeIdentifier,
                                         request.sender)
             d.addCallback(lambda ignore,
@@ -710,8 +711,7 @@
                           request)
             return d
 
-        raise failure
-
+        return failure
 
     def publish(self, request):
         d = self.backend.publish(request.nodeIdentifier,