Convert build_connstring into a one-liner, per code review by Alex.

This commit is contained in:
Oleksii Kliukin
2015-11-24 16:40:18 +01:00
parent 4b1ff5a4bb
commit d8a8fe9a80
+2 -6
View File
@@ -230,14 +230,10 @@ class Postgresql:
@staticmethod
def build_connstring(conn):
"""
>>> Postgresql.build_connstring({'host': '127.0.0.1', 'port': '5432'}) == 'host=127.0.0.1 port=5432 '
>>> Postgresql.build_connstring({'host': '127.0.0.1', 'port': '5432'}) == 'host=127.0.0.1 port=5432'
True
"""
mconn = ""
for param, val in sorted(conn.items()):
mconn = mconn + "{0}={1} ".format(param, val)
return mconn
return ' '.join('{}={}'.format(param, val) for param, val in sorted(conn.items()))
def create_replica(self, leader, env):
# create the replica according to the replica_method