comparison sat_pubsub/pgsql_storage.py @ 263:9dfd3890e646

added the constant FLAG_RETRACT_ALLOW_PUBLISHER to allow a publisher to retract an item he has published in a node of "open" publish model.
author souliane <souliane@mailoo.org>
date Fri, 21 Feb 2014 16:10:11 +0100
parents 7b821432d012
children 89493845d3dd
comparison
equal deleted inserted replaced
262:7b821432d012 263:9dfd3890e646
718 cursor.execute("""DELETE FROM items WHERE 718 cursor.execute("""DELETE FROM items WHERE
719 node_id=(SELECT node_id FROM nodes WHERE node=%s)""", 719 node_id=(SELECT node_id FROM nodes WHERE node=%s)""",
720 (self.nodeIdentifier,)) 720 (self.nodeIdentifier,))
721 721
722 722
723 def filterItemsWithPublisher(self, itemIdentifiers, requestor):
724 return self.dbpool.runInteraction(self._filterItemsWithPublisher, itemIdentifiers, requestor)
725
726 def _filterItemsWithPublisher(self, cursor, itemIdentifiers, requestor):
727 self._checkNodeExists(cursor)
728 ret = []
729 for itemIdentifier in itemIdentifiers:
730 args = ["%s/%%" % requestor.userhost(), itemIdentifier]
731 cursor.execute("""SELECT item FROM items WHERE publisher LIKE %s AND item=%s""", args)
732 result = cursor.fetchone()
733 if result:
734 ret.append(result[0])
735 return ret
736
723 class CollectionNode(Node): 737 class CollectionNode(Node):
724 738
725 nodeType = 'collection' 739 nodeType = 'collection'
726 740
727 741