comparison idavoll/pgsql_storage.py @ 171:bc269696ef42

Reply with the correct error condition on subscription when not subscribed. Author: ralphm. Fixes #7.
author Ralph Meijer <ralphm@ik.nu>
date Thu, 03 Jan 2008 13:10:25 +0000
parents 958e69630e52
children 246911bcb699
comparison
equal deleted inserted replaced
170:958e69630e52 171:bc269696ef42
1 # Copyright (c) 2003-2007 Ralph Meijer 1 # Copyright (c) 2003-2008 Ralph Meijer
2 # See LICENSE for details. 2 # See LICENSE for details.
3 3
4 import copy 4 import copy
5 from twisted.enterprise import adbapi 5 from twisted.enterprise import adbapi
6 from twisted.words.protocols.jabber import jid 6 from twisted.words.protocols.jabber import jid
108 def _convert_subscription_jids(self, subscriptions): 108 def _convert_subscription_jids(self, subscriptions):
109 return [(node, 109 return [(node,
110 jid.internJID('%s/%s' % (subscriber, resource)), 110 jid.internJID('%s/%s' % (subscriber, resource)),
111 subscription) 111 subscription)
112 for node, subscriber, resource, subscription in subscriptions] 112 for node, subscriber, resource, subscription in subscriptions]
113
113 114
114 class Node: 115 class Node:
115 116
116 implements(iidavoll.INode) 117 implements(iidavoll.INode)
117 118
243 AND resource=%s""", 244 AND resource=%s""",
244 (self.id, 245 (self.id,
245 userhost, 246 userhost,
246 resource)) 247 resource))
247 if cursor.rowcount != 1: 248 if cursor.rowcount != 1:
248 raise error.SubscriptionNotFound() 249 raise error.NotSubscribed()
249 250
250 return None 251 return None
251 252
252 def get_subscribers(self): 253 def get_subscribers(self):
253 d = self._dbpool.runInteraction(self._get_subscribers) 254 d = self._dbpool.runInteraction(self._get_subscribers)