comparison idavoll/pgsql_storage.py @ 170:958e69630e52

Provide twistd parameters for connecting to a remote PostgreSQL database. Author: edwinm (ralphm) Reviewer: ralphm Fixes #6.
author Ralph Meijer <ralphm@ik.nu>
date Tue, 09 Oct 2007 10:20:25 +0000
parents ef22e4150caa
children bc269696ef42
comparison
equal deleted inserted replaced
169:96afb248df5e 170:958e69630e52
10 10
11 class Storage: 11 class Storage:
12 12
13 implements(iidavoll.IStorage) 13 implements(iidavoll.IStorage)
14 14
15 def __init__(self, user, database, password = None): 15 def __init__(self, user, database, password=None, host=None, port=None):
16 self._dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL', 16 self._dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL',
17 user=user, 17 user=user,
18 password=password, 18 password=password,
19 database=database, 19 database=database,
20 host=host,
21 port=port,
22 cp_reconnect=True,
20 client_encoding='utf-8' 23 client_encoding='utf-8'
21 ) 24 )
22 25
23 def get_node(self, node_id): 26 def get_node(self, node_id):
24 return self._dbpool.runInteraction(self._get_node, node_id) 27 return self._dbpool.runInteraction(self._get_node, node_id)