[CalendarServer-changes] [14455] CalendarServer/branches/users/pg8000-1/txdav/base/datastore/ subpostgres.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 19 16:00:46 PST 2015


Revision: 14455
          http://trac.calendarserver.org//changeset/14455
Author:   wsanchez at apple.com
Date:     2015-02-19 16:00:46 -0800 (Thu, 19 Feb 2015)
Log Message:
-----------
Make the Unix sockets happy

Modified Paths:
--------------
    CalendarServer/branches/users/pg8000-1/txdav/base/datastore/subpostgres.py

Modified: CalendarServer/branches/users/pg8000-1/txdav/base/datastore/subpostgres.py
===================================================================
--- CalendarServer/branches/users/pg8000-1/txdav/base/datastore/subpostgres.py	2015-02-19 23:34:43 UTC (rev 14454)
+++ CalendarServer/branches/users/pg8000-1/txdav/base/datastore/subpostgres.py	2015-02-20 00:00:46 UTC (rev 14455)
@@ -250,7 +250,7 @@
                 addr.split(":")[0] for addr in listenAddresses
             ]
         else:
-            self.host = self.socketDir.path
+            self.host = ""
             self.port = None
             self.listenAddresses = []
 
@@ -317,18 +317,20 @@
         if databaseName is None:
             databaseName = self.databaseName
 
-        kwargs = dict(database=databaseName)
+        if self.port:
+            port = self.port
+        else:
+            port = 5432
 
-        if self.host.startswith("/"):
-            kwargs["host"] = None
-            kwargs["unix_sock"] = self.host
+        kwargs = dict(host=self.host, port=port, database=databaseName)
+
+        if self.host:
+            kwargs["unix_sock"] = None
         else:
-            kwargs["host"] = self.host
-            kwargs["unix_sock"] = None
+            kwargs["unix_sock"] = self.socketDir.child(
+                ".s.PGSQL.{}".format(port)
+            ).path
 
-        if self.port:
-            kwargs["port"] = self.port
-
         if self.spawnedDBUser:
             kwargs["user"] = self.spawnedDBUser
         elif self.uid is not None:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150219/7c809038/attachment.html>


More information about the calendarserver-changes mailing list