Mercurial > libervia-pubsub
diff idavoll/pgsql_backend.py @ 95:3ad74552bbc7
Merge from RELENG_0: Implemented node configuration.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Tue, 23 Nov 2004 16:18:52 +0000 |
parents | 59378610b16e |
children | b9c449f4c167 |
line wrap: on
line diff
--- a/idavoll/pgsql_backend.py Wed Nov 17 21:08:29 2004 +0000 +++ b/idavoll/pgsql_backend.py Tue Nov 23 16:18:52 2004 +0000 @@ -23,8 +23,8 @@ WHERE node=%s""", (node_id,)) try: - (configuration["persist_items"], - configuration["deliver_payloads"]) = cursor.fetchone() + (configuration["pubsub#persist_items"], + configuration["pubsub#deliver_payloads"]) = cursor.fetchone() return configuration except TypeError: raise backend.NodeNotFound @@ -328,6 +328,20 @@ cursor.execute("""DELETE FROM nodes WHERE node=%s""", (node_id.encode('utf-8'),)) + def set_node_configuration(self, node_id, options): + return self.dbpool.runInteraction(self._set_node_configuration, + node_id, + options) + + def _set_node_configuration(self, cursor, node_id, options): + cursor.execute("""UPDATE nodes SET persistent=%s, deliver_payload=%s + WHERE node=%s""", + (options["pubsub#persist_items"].encode('utf8'), + options["pubsub#deliver_payloads"].encode('utf8'), + node_id.encode('utf-8'))) + if cursor.rowcount != 1: + raise backend.Error + class BackendService(backend.BackendService): """ PostgreSQL backend Service for a JEP-0060 pubsub service """