Richard Jones avatar Richard Jones committed b361f5e

add database port as an option in config

Comments (0)

Files changed (3)


 driver = postgresql2
 name = packages
 user = pypi
+# host = hostname
+# port = 5432
 files_dir = /MacDev/
 docs_dir = /MacDev/
             self.database_host = c.get('database', 'host')
             self.database_host = None
+        if c.has_option('database', 'port'):
+            self.database_port = c.getint('database', 'port')
+        else:
+            self.database_port = None
         self.database_files_dir = c.get('database', 'files_dir')
         self.database_docs_dir = c.get('database', 'docs_dir')
         if c.has_option('database', 'pubsubhubbub'):
         global connection
         # ensure files are group readable and writable
-        cd = dict(database=self.config.database_name, user=self.config.database_user)
+        cd = dict(database=self.config.database_name,
+            user=self.config.database_user)
         if self.config.database_pw:
             cd['password'] = self.config.database_pw
         if self.config.database_host:
             cd['host'] = self.config.database_host
+        if self.config.database_port:
+            cd['port'] = self.config.database_port
         if keep_conn and connection:
             self._conn = connection
             # Rollback any uncommitted earlier change
-            except psycopg2.InterfaceError, e:
+            except psycopg2.InterfaceError:
                 # already closed
                 connection = None
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.