Mercurial > libervia-pubsub
changeset 308:087b705493a6
fixed publisher check on item publishing
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 18 Dec 2015 13:01:02 +0100 |
parents | c057d78b482f |
children | 890b24b37b56 |
files | sat_pubsub/backend.py sat_pubsub/pgsql_storage.py |
diffstat | 2 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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()
--- 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