[mirrorbrain-commits] r8313 - /trunk/mb/mb/conn.py

From: <poeml_at_mirrorbrain.org>
Date: Thu, 02 Jan 2014 15:54:07 -0000
Author: poeml
Date: Thu Jan  2 16:54:07 2014
New Revision: 8313

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8313&view=rev
Log:
mb:
- give a sane error messages if a config statement is missing/misspelled.

Modified:
    trunk/mb/mb/conn.py

Modified: trunk/mb/mb/conn.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb/conn.py?rev=8313&r1=8312&r2=8313&view=diff
==============================================================================
--- trunk/mb/mb/conn.py	(original)
+++ trunk/mb/mb/conn.py	Thu Jan  2 16:54:07 2014
_at_@ -104,6 +104,24 @@
             except: 
                 sys.exit('To use mb with PostgreSQL, you need the pcycopg2 Python module installed.')
             # see http://mirrorbrain.org/issues/issue27
+
+            try:
+                config['dbpass']
+            except:
+                sys.exit("Your config doesn't have a 'dbpass' setting.")
+            try:
+                config['dbuser']
+            except:
+                sys.exit("Your config doesn't have a 'dbuser' setting.")
+            try:
+                config['dbhost']
+            except:
+                sys.exit("Your config doesn't have a 'dbhost' setting.")
+            try:
+                config['dbname']
+            except:
+                sys.exit("Your config doesn't have a 'dbname' setting.")
+
             config['dbpass'] = config['dbpass'].replace(' ', r'\ ')
             config['dbpass'] = config['dbpass'].replace('\t', '\\\t')
             config['dbpass'] = config['dbpass'].replace("'", r"\'")




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Thu Jan 02 2014 - 15:54:10 GMT

This archive was generated by hypermail 2.3.0 : Thu Jan 02 2014 - 16:17:09 GMT