# HG changeset patch # User souliane # Date 1393052649 -3600 # Node ID 89493845d3ddd90386117e333cb78f7f8f0f0b5c # Parent 86e767dc6abb6be3cb4d9590714b7bccfefbdc04 fix the method signatures of iidavoll.ILeafNode and memory_storage.LeafNode according to pgsql_storage.LeafNode diff -r 86e767dc6abb -r 89493845d3dd sat_pubsub/iidavoll.py --- a/sat_pubsub/iidavoll.py Sat Feb 22 06:10:24 2014 +0100 +++ b/sat_pubsub/iidavoll.py Sat Feb 22 08:04:09 2014 +0100 @@ -537,22 +537,23 @@ """ - def getItems(maxItems=None): - """ - Get items. - - If C{maxItems} is not given, all items in the node are returned, + def getItems(authorized_groups, unrestricted, maxItems=None): + """ Get all authorised items + If C{maxItems} is not given, all authorised items in the node are returned, just like C{getItemsById}. Otherwise, C{maxItems} limits the returned items to a maximum of that number of most recently - published items. + published and authorised items. + @param authorized_groups: we want to get items that these groups can access + @param unrestricted: if true, don't check permissions (i.e.: get all items) @param maxItems: if given, a natural number (>0) that limits the returned number of items. - @return: deferred that fires with a C{list} of found items. + @return: deferred that fires a C{list} of (item, access_model, id) + if unrestricted is True, else a C{list} of items. """ - def getItemsById(itemIdentifiers): + def getItemsById(authorized_groups, unrestricted, itemIdentifiers): """ Get items by item id. @@ -560,8 +561,11 @@ represent the XML of the item as it was published, including the item wrapper with item id. + @param authorized_groups: we want to get items that these groups can access + @param unrestricted: if true, don't check permissions @param itemIdentifiers: C{list} of item ids. - @return: deferred that fires with a C{list} of found items. + @return: deferred that fires a C{list} of (item, access_model, id) + if unrestricted is True, else a C{list} of items. """ diff -r 86e767dc6abb -r 89493845d3dd sat_pubsub/memory_storage.py --- a/sat_pubsub/memory_storage.py Sat Feb 22 06:10:24 2014 +0100 +++ b/sat_pubsub/memory_storage.py Sat Feb 22 08:04:09 2014 +0100 @@ -263,8 +263,8 @@ self._itemlist = [] - def storeItems(self, items, publisher): - for element in items: + def storeItems(self, item_data, publisher): + for access_model, item_config, element in item_data: item = PublishedItem(element, publisher) itemIdentifier = element["id"] if itemIdentifier in self._items: @@ -291,7 +291,7 @@ return defer.succeed(deleted) - def getItems(self, maxItems=None): + def getItems(self, authorized_groups, unrestricted, maxItems=None): if maxItems: itemList = self._itemlist[-maxItems:] else: @@ -299,7 +299,7 @@ return defer.succeed([item.element for item in itemList]) - def getItemsById(self, itemIdentifiers): + def getItemsById(self, authorized_groups, unrestricted, itemIdentifiers): items = [] for itemIdentifier in itemIdentifiers: try: diff -r 86e767dc6abb -r 89493845d3dd sat_pubsub/pgsql_storage.py --- a/sat_pubsub/pgsql_storage.py Sat Feb 22 06:10:24 2014 +0100 +++ b/sat_pubsub/pgsql_storage.py Sat Feb 22 08:04:09 2014 +0100 @@ -606,7 +606,7 @@ @param authorized_groups: we want to get items that these groups can access @param unrestricted: if true, don't check permissions (i.e.: get all items) @param maxItems: nb of items we want to tget - @return: list of (item, access_model, access_model) if unrestricted is True, else list of items + @return: list of (item, access_model, id) if unrestricted is True, else list of items """ return self.dbpool.runInteraction(self._getItems, authorized_groups, unrestricted, maxItems)