comparison sat/plugins/plugin_comp_file_sharing.py @ 3721:6878745a47e8

component file sharing: fix incorrect use of `returnValue` in `items` async method
author Goffi <goffi@goffi.org>
date Tue, 25 Jan 2022 17:13:32 +0100
parents 09f5ac48ffe3
children 75f8d206e551
comparison
equal deleted inserted replaced
3720:40a6374fcd44 3721:6878745a47e8
812 comments_dict.remove(comment) 812 comments_dict.remove(comment)
813 except ValueError: 813 except ValueError:
814 continue 814 continue
815 815
816 def _getFrom(self, item_elt): 816 def _getFrom(self, item_elt):
817 """retrieve published of an item 817 """retrieve publisher of an item
818 818
819 @param item_elt(domish.element): <item> element 819 @param item_elt(domish.element): <item> element
820 @return (unicode): full jid as string 820 @return (unicode): full jid as string
821 """ 821 """
822 iq_elt = item_elt 822 iq_elt = item_elt
843 @ensure_deferred 843 @ensure_deferred
844 async def items(self, requestor, service, nodeIdentifier, maxItems, itemIdentifiers): 844 async def items(self, requestor, service, nodeIdentifier, maxItems, itemIdentifiers):
845 file_data = await self.getFileData(requestor, nodeIdentifier) 845 file_data = await self.getFileData(requestor, nodeIdentifier)
846 comments = file_data["extra"].get("comments", []) 846 comments = file_data["extra"].get("comments", [])
847 if itemIdentifiers: 847 if itemIdentifiers:
848 defer.returnValue( 848 return [generic.parseXml(c[2]) for c in comments if c[0] in itemIdentifiers]
849 [generic.parseXml(c[2]) for c in comments if c[0] in itemIdentifiers]
850 )
851 else: 849 else:
852 return [generic.parseXml(c[2]) for c in comments] 850 return [generic.parseXml(c[2]) for c in comments]
853 851
854 @ensure_deferred 852 @ensure_deferred
855 async def retract(self, requestor, service, nodeIdentifier, itemIdentifiers): 853 async def retract(self, requestor, service, nodeIdentifier, itemIdentifiers):