diff sat_pubsub/pgsql_storage.py @ 260:f0cd02c032b3

publish model management
author Goffi <goffi@goffi.org>
date Mon, 06 May 2013 00:26:37 +0200
parents 6fe7da6b4b32
children 7b821432d012
line wrap: on
line diff
--- a/sat_pubsub/pgsql_storage.py	Mon May 06 00:11:44 2013 +0200
+++ b/sat_pubsub/pgsql_storage.py	Mon May 06 00:26:37 2013 +0200
@@ -74,11 +74,13 @@
                 "pubsub#deliver_payloads": True,
                 "pubsub#send_last_published_item": 'on_sub',
                 const.OPT_ACCESS_MODEL: const.VAL_AMODEL_DEFAULT,
+                const.OPT_PUBLISH_MODEL: const.VAL_PMODEL_DEFAULT,
             },
             'collection': {
                 "pubsub#deliver_payloads": True,
                 "pubsub#send_last_published_item": 'on_sub',
                 const.OPT_ACCESS_MODEL: const.VAL_AMODEL_DEFAULT,
+                const.OPT_PUBLISH_MODEL: const.VAL_PMODEL_DEFAULT,
             }
     }
 
@@ -96,6 +98,7 @@
                                  deliver_payloads,
                                  send_last_published_item,
                                  access_model,
+                                 publish_model
                           FROM nodes
                           WHERE node=%s""",
                        (nodeIdentifier,))
@@ -110,6 +113,7 @@
                     'pubsub#deliver_payloads': row[2],
                     'pubsub#send_last_published_item': row[3],
                     const.OPT_ACCESS_MODEL:row[4],
+                    const.OPT_PUBLISH_MODEL:row[5],
                     }
             node = LeafNode(nodeIdentifier, configuration)
             node.dbpool = self.dbpool
@@ -119,6 +123,7 @@
                     'pubsub#deliver_payloads': row[2],
                     'pubsub#send_last_published_item': row[3],
                     const.OPT_ACCESS_MODEL: row[4],
+                    const.OPT_PUBLISH_MODEL:row[5],
                     }
             node = CollectionNode(nodeIdentifier, configuration)
             node.dbpool = self.dbpool
@@ -145,14 +150,15 @@
         try:
             cursor.execute("""INSERT INTO nodes
                               (node, node_type, persist_items,
-                               deliver_payloads, send_last_published_item, access_model)
+                               deliver_payloads, send_last_published_item, access_model, publish_model)
                               VALUES
-                              (%s, 'leaf', %s, %s, %s, %s)""",
+                              (%s, 'leaf', %s, %s, %s, %s, %s)""",
                            (nodeIdentifier,
                             config['pubsub#persist_items'],
                             config['pubsub#deliver_payloads'],
                             config['pubsub#send_last_published_item'],
                             config[const.OPT_ACCESS_MODEL],
+                            config[const.OPT_PUBLISH_MODEL],
                             )
                            )
         except cursor._pool.dbapi.IntegrityError: