Mercurial > libervia-pubsub
comparison sat_pubsub/tap.py @ 276:b757c29b20d7
import changes from idavoll changeset 233 (24be3a11ddbc), by Ralph Meijer and based on a patch by Nuno Santos
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 13 Oct 2014 15:59:25 +0200 |
parents | d55620ceafed |
children | 8a71486c3e95 |
comparison
equal
deleted
inserted
replaced
275:9c74cd2635f6 | 276:b757c29b20d7 |
---|---|
99 # Create backend service with storage | 99 # Create backend service with storage |
100 | 100 |
101 if config['backend'] == 'pgsql': | 101 if config['backend'] == 'pgsql': |
102 from twisted.enterprise import adbapi | 102 from twisted.enterprise import adbapi |
103 from sat_pubsub.pgsql_storage import Storage | 103 from sat_pubsub.pgsql_storage import Storage |
104 from psycopg2.extras import NamedTupleConnection | |
104 dbpool = adbapi.ConnectionPool('psycopg2', | 105 dbpool = adbapi.ConnectionPool('psycopg2', |
105 user=config['dbuser'], | 106 user=config['dbuser'], |
106 password=config['dbpass'], | 107 password=config['dbpass'], |
107 database=config['dbname'], | 108 database=config['dbname'], |
108 host=config['dbhost'], | 109 host=config['dbhost'], |
109 port=config['dbport'], | 110 port=config['dbport'], |
110 cp_reconnect=True, | 111 cp_reconnect=True, |
111 client_encoding='utf-8', | 112 client_encoding='utf-8', |
113 connection_factory=NamedTupleConnection, | |
112 ) | 114 ) |
113 st = Storage(dbpool) | 115 st = Storage(dbpool) |
114 elif config['backend'] == 'memory': | 116 elif config['backend'] == 'memory': |
115 from sat_pubsub.memory_storage import Storage | 117 from sat_pubsub.memory_storage import Storage |
116 st = Storage() | 118 st = Storage() |