diff sat_pubsub/pgsql_storage.py @ 308:087b705493a6

fixed publisher check on item publishing
author Goffi <goffi@goffi.org>
date Fri, 18 Dec 2015 13:01:02 +0100
parents 05c875a13a62
children 890b24b37b56
line wrap: on
line diff
--- a/sat_pubsub/pgsql_storage.py	Mon Dec 07 19:20:47 2015 +0100
+++ b/sat_pubsub/pgsql_storage.py	Fri Dec 18 13:01:02 2015 +0100
@@ -915,7 +915,8 @@
     def getItemsPublishers(self, itemIdentifiers):
         """Get the publishers for all given identifiers
 
-        @return (dict): map of itemIdentifiers to publisher
+        @return (dict[unicode, jid.JID]): map of itemIdentifiers to publisher
+            if item is not found, key is skipped in resulting dict
         """
         return self.dbpool.runInteraction(self._getItemsPublishers, itemIdentifiers)
 
@@ -928,11 +929,8 @@
                               WHERE item=%s""",
                             (itemIdentifier,))
             result = cursor.fetchone()
-            if not result:
-                # We have an internal error, that's why we use ValueError
-                # and not error.ItemNotFound()
-                raise ValueError() # itemIdentifier must exists
-            ret[itemIdentifier] = jid.JID(result[0])
+            if result:
+                ret[itemIdentifier] = jid.JID(result[0])
         return ret