diff idavoll/backend.py @ 18:7937d6fbbe2a

Small code cleanups
author Ralph Meijer <ralphm@ik.nu>
date Mon, 30 Aug 2004 17:41:18 +0000
parents 46cd13c68ac0
children eddea65d1032
line wrap: on
line diff
--- a/idavoll/backend.py	Mon Jul 26 11:40:52 2004 +0000
+++ b/idavoll/backend.py	Mon Aug 30 17:41:18 2004 +0000
@@ -57,6 +57,7 @@
 
 		node = Node("ralphm/mood/ralphm@ik.nu")
 		node.subscriptions["ralphm@doe.ik.nu"] = Subscription("subscribed")
+		node.subscriptions["notify@ik.nu/mood_monitor"] = Subscription("subscribed")
 		node.affiliations["ralphm@ik.nu"] = "owner"
 		node.affiliations["ralphm@doe.ik.nu"] = "publisher"
 		node.configuration.persist_items = True
@@ -78,10 +79,6 @@
 			except KeyError:
 				raise NotAuthorized()
 
-			# the following is under the assumption that the publisher
-			# has to provide an item when the node is persistent, but
-			# an empty notification is to be sent.
-
 			if items and not persist_items and not deliver_payloads:
 				raise NoPayloadAllowed
 			elif not items and (persist_items or deliver_payloads):
@@ -107,8 +104,7 @@
 
 			return defer.succeed(None)
 		except:
-			f = failure.Failure()
-			return defer.fail(f)
+			return defer.fail(failure.Failure())
 
 	def do_subscribe(self, node_id, subscriber, requestor):
 		# expect subscriber and requestor to be a jid.JID 
@@ -144,8 +140,7 @@
 					'jid': subscriber,
 					'subscription': subscription.state})
 		except:
-			f = failure.Failure()
-			return defer.fail(f)
+			return defer.fail(failure.Failure)
 
 		
 	def magic_filter(self, subscribers, node_id, items):