# HG changeset patch # User Goffi # Date 1450440062 -3600 # Node ID 087b705493a612fb22b3aad2436621b0ac22b579 # Parent c057d78b482fe38acf7d9c5424a7954339d6dc77 fixed publisher check on item publishing diff -r c057d78b482f -r 087b705493a6 sat_pubsub/backend.py --- a/sat_pubsub/backend.py Mon Dec 07 19:20:47 2015 +0100 +++ b/sat_pubsub/backend.py Fri Dec 18 13:01:02 2015 +0100 @@ -291,7 +291,7 @@ """Check that the itemIdentifiers correspond to items published by the current publisher""" def doCheck(item_pub_map): - for item_publisher in item_pub_map.iterValues(): + for item_publisher in item_pub_map.itervalues(): if item_publisher.userhost() != publisher.userhost(): raise error.ItemForbidden() diff -r c057d78b482f -r 087b705493a6 sat_pubsub/pgsql_storage.py --- 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