Index: trunk/ippToPsps/jython/ipptopspsdb.py
===================================================================
--- trunk/ippToPsps/jython/ipptopspsdb.py	(revision 33725)
+++ trunk/ippToPsps/jython/ipptopspsdb.py	(revision 33726)
@@ -854,36 +854,53 @@
         return configs
 
-
-    '''
-    Writes current Config object to Db
-    '''
-    def writeConfig(self):
-
-        sql = "UPDATE config \
-               SET \
-               datastore_product = '" + self.config.datastoreProduct + "' \
-               ,datastore_type = '" + self.config.datastoreType + "' \
-               ,datastore_publish = " + self.config.datastorePublishing + " \
-               ,dvo_label = '" + self.config.dvoLabel + "' \
-               ,dvo_location = '" + self.config.dvoLocation + "' \
-               ,min_ra = " + self.config.minRa + " \
-               ,max_ra = " + self.config.maxRa + " \
-               ,min_dec = " + self.config.minDec + " \
-               ,max_dec = " + self.config.maxDec + " \
-               ,box_size = " + self.config.boxSize + " \
-               ,base_path = '" + self.config.basePath + "' \
-               ,data_release = " + self.config.dataRelease + " \
-               ,delete_local = " + self.config.deleteLocal + " \
-               ,delete_datastore = " + self.config.deleteDatastore + " \
-               ,delete_dxlayer = " + self.config.deleteDxLayer + " \
-               ,epoch = '" + self.config.epoch + "' \
-               ,survey = '" + self.config.survey + "' \
-               ,psps_survey = '" + self.config.pspsSurvey + "' \
-               ,queue_P2 = " + self.config.queuingThisBatchType("P2") + " \
-               ,queue_ST = " + self.config.queuingThisBatchType("ST") + " \
-               ,queue_OB = " + self.config.queuingThisBatchType("OB") + " \
-               WHERE name = '" + self.config.name + "'"
-
-        self.execute(sql) 
+    '''
+    Prompts user for info about a new or existing config and lets them neter the various details
+    '''
+    def editConfig(self):
+
+       response = raw_input(" * Name for new config, or existing config to edit? ")
+       if response == "": return
+       self.config.name = response
+
+       # attempt to insert new config, if it already exists then carry on with update
+       sql = "INSERT INTO config (name) VALUES ('" + self.config.name + "')"
+       try:        
+           self.execute(sql) 
+       except: pass
+
+       # for each column in the config table
+       sql = "SHOW COLUMNS FROM config"
+       rs = self.executeQuery(sql)
+       while (rs.next()):
+
+           field = rs.getString(1)
+           type = rs.getString(2)
+           null = rs.getString(3)
+
+           # things we don;t want the user to edit
+           if field == 'timestamp': continue
+           if field == 'name': continue
+
+           # get current value for this field, if any
+           try:
+               rs2 = self.executeQuery("SELECT " + field + " FROM config WHERE name = '" + self.config.name + "'")
+               rs2.first()
+               default = rs2.getString(1)
+           except: pass
+
+           question = " * " + field + " (" + type + ")"
+
+           # there may not be a default value
+           try: question = question +  " hit return to accept default of: '" + default + "'"
+           except: pass
+
+           # prompt the user for new value or to accept existing value
+           question = question +  "? "
+           response = raw_input(question)
+           if response != "":
+               if type.find("varchar") != -1 or type.find("timestamp") != -1: quotes = "'"
+               else: quotes = ""
+               self.execute("UPDATE config SET " + field + " = " + quotes + response + quotes + " WHERE name = '" + self.config.name + "'")
+       
 
     '''
