comparison idavoll/pgsql_storage.py @ 148:b03e5ad81173

Change all calls to jid.JID to jid.internJID to avoid redoing stringprep.
author Ralph Meijer <ralphm@ik.nu>
date Wed, 31 Aug 2005 12:58:50 +0000
parents b4490bdc77e5
children 5191ba7c4df8
comparison
equal deleted inserted replaced
147:fee92e499d6d 148:b03e5ad81173
97 (entity.userhost(),)) 97 (entity.userhost(),))
98 d.addCallback(self._convert_subscription_jids) 98 d.addCallback(self._convert_subscription_jids)
99 return d 99 return d
100 100
101 def _convert_subscription_jids(self, subscriptions): 101 def _convert_subscription_jids(self, subscriptions):
102 return [(node, jid.JID('%s/%s' % (subscriber, resource)), subscription) 102 return [(node,
103 jid.internJID('%s/%s' % (subscriber, resource)),
104 subscription)
103 for node, subscriber, resource, subscription in subscriptions] 105 for node, subscriber, resource, subscription in subscriptions]
104 106
105 class Node: 107 class Node:
106 108
107 implements(storage.INode) 109 implements(storage.INode)
254 subscription='subscribed'""", 256 subscription='subscribed'""",
255 (self.id,)) 257 (self.id,))
256 return cursor.fetchall() 258 return cursor.fetchall()
257 259
258 def _convert_to_jids(self, list): 260 def _convert_to_jids(self, list):
259 return [jid.JID("%s/%s" % (l[0], l[1])) for l in list] 261 return [jid.internJID("%s/%s" % (l[0], l[1])) for l in list]
260 262
261 def is_subscribed(self, entity): 263 def is_subscribed(self, entity):
262 return self._dbpool.runInteraction(self._is_subscribed, entity) 264 return self._dbpool.runInteraction(self._is_subscribed, entity)
263 265
264 def _is_subscribed(self, cursor, entity): 266 def _is_subscribed(self, cursor, entity):
289 (affiliations.entity_id = entities.id) 291 (affiliations.entity_id = entities.id)
290 WHERE node=%s""", 292 WHERE node=%s""",
291 self.id) 293 self.id)
292 result = cursor.fetchall() 294 result = cursor.fetchall()
293 295
294 return [(jid.JID(r[0]), r[1]) for r in result] 296 return [(jid.internJID(r[0]), r[1]) for r in result]
295 297
296 class LeafNodeMixin: 298 class LeafNodeMixin:
297 299
298 type = 'leaf' 300 type = 'leaf'
299 301