Index: trunk/ippToPsps/jython/config.py
===================================================================
--- trunk/ippToPsps/jython/config.py	(revision 33728)
+++ trunk/ippToPsps/jython/config.py	(revision 35097)
@@ -1,4 +1,6 @@
 #!/usr/bin/env jython
 
+import sys
+import os
 import logging
 from xml.etree.ElementTree import ElementTree, Element, tostring
@@ -6,11 +8,9 @@
 from pslogger import PSLogger
 
-
 '''
-A class encapsulating a ippToPsps configuration. This information is stored in the 'config' table
-of the ipptopsps database, but there are some higher level config details in the 'settings.xml' file
+A class encapsulating the globald ippToPsps configuration information.
+This is stored in the 'settings.xml' file in the config directory
 '''
 class Config(object):
-
 
     '''
@@ -19,51 +19,48 @@
     Basically reads the entire config and stores values to class variables
     '''
-    def __init__(self, programName, name):
+    def __init__(self):
 
-        self.programName = programName
-        self.name = name
-        self.settingsPath = "../config/settings.xml" # TODO
+        self.test = False
+        for arg in sys.argv:
+            if arg == "-test": 
+                self.test = True
+                sys.argv.remove(arg)
+            if arg == "-t": 
+                self.test = True
+                sys.argv.remove(arg)
+
+        ## name of the top-level jython script
+        self.programName = os.path.basename(sys.argv[0])
+
+        ## this is somewhat crude: ipptopsps programs are called like this: 
+        ## ippjython foo.py [chunk] [other options]
+        ## the logging code (called below by getLogger) wants to include 'name' in the 
+        ## output file.  we blindly set name == argv[1] 
+        ## programs which are called without argv[1] will use 'none' in the log file
+        if len(sys.argv) >= 2:
+            self.name = sys.argv[1]
+
+        # XXX this probably goes in 'config.py'
+        self.configDir = os.getenv("IPPTOPSPS_DATA")
+        if self.configDir is None:
+            self.configDir = "../config/"
+        else:
+            self.configDir = self.configDir + "/"
+
+        # self.configdir is set in ipptopsps.jy on init based on env(IPPTOPSPS_DATA)
+        # for test purposes, an uninstalled system may use the config information from 
+        # a relative path
+        self.settingsPath = self.configDir + "settings.xml"
+
         self.logger = None
 
         self.settingsDoc = ElementTree(file=self.settingsPath)
         self.logPath = self.settingsDoc.find("logPath").text
-        self.czarPlotsPath = self.settingsDoc.find("czarPlotsPath").text
 
-        # this is the border (in degrees) that we place around any loading box of 
-        # PS1 pointings to ensure we pull a large enough area out of DVO
-        self.BORDER = 1.65
-        self.isLoaded = False
-
-    '''
-    Prints everything for this config
-    '''
-    def printAll(self):
-
-        self.logger.infoTitle("Config")
-
-        try:
-            self.logger.infoSeparator()
-            self.logger.infoPair("Config name", self.name)
-            self.logger.infoPair("Survey", self.survey)
-            self.logger.infoPair("Publishing to PSPS as survey", self.pspsSurvey)
-            self.logger.infoPair("Loading epoch", self.epoch)
-            self.logger.infoPair("Data release", "%d" % self.dataRelease)
-            for batchType in self.batchTypes: self.logger.infoPair("Queuing batch type", batchType)
-        except:
-            pass
-
-        self.printDvoInfo()
-        self.printDatastoreInfo()
-        self.printBoxCoords()
-        self.printDeletionPolicy()
-        try: self.logger.infoSeparator()
-        except: pass
-
-    '''
-    Queuing this batch type?
-    '''
-    def queuingThisBatchType(self, batchType):
-       if batchType in self.batchTypes: return 1
-       return 0
+        print "config.programName: ", self.programName
+        print "config.configDir: ", self.configDir
+        print "config.settingsPath: ", self.settingsPath
+        print "config.logPath: ", self.logPath
+        print "config.test: ", self.test
 
     '''
@@ -72,58 +69,16 @@
     def getLogger(self, host, pid, stdout=1, sendToFile=0):
         
+        print "get Logger: ", host, pid
         logging.setLoggerClass(PSLogger)
+        print "done Logger 1"
         self.logger = logging.getLogger(self.programName)
-        self.logger.setup(self.programName, self.logPath, self.name, host, pid, stdout, sendToFile)
+        print "done Logger 2"
+        if (self.name is None):
+            self.logger.setup(self.programName, self.logPath, "none", host, pid, stdout, sendToFile)
+        else:
+            self.logger.setup(self.programName, self.logPath, self.name, host, pid, stdout, sendToFile)
+        print "done Logger 3"
 
         return self.logger
-
-    '''
-    Prints the currently set DVO info
-    '''
-    def printDvoInfo(self):
-
-        try:
-            self.logger.infoPair("DVO label", self.dvoLabel)
-            self.logger.infoPair("DVO location", self.dvoLocation)
-        except:
-            pass
-   
-    '''
-    Prints datastore info
-    '''
-    def printDatastoreInfo(self):
-
-        try:
-            self.logger.infoBool("Datastore publishing?", self.datastorePublishing)
-            if self.datastorePublishing:
-                self.logger.infoPair("Datastore type", self.datastoreProduct)
-                self.logger.infoPair("Datastore product", self.datastoreType)
-        except:
-            pass
-   
-    '''
-    Prints the current deletion policy
-    '''
-    def printDeletionPolicy(self):
-
-        try:
-            self.logger.infoBool("Deleting local?", self.deleteLocal)
-            self.logger.infoBool("Deleting datastore?", self.deleteDatastore)
-            self.logger.infoBool("Deleting DXLayer?", self.deleteDxLayer)
-        except:
-            pass
-   
-    '''
-    Prints the currently set RA/Dec bounding box
-    '''
-    def printBoxCoords(self):
-
-        try:
-            self.logger.infoPair("RA limits", "%.1f -> %.1f" % (self.minRa, self.maxRa))
-            self.logger.infoPair("Dec limits", "%.1f -> %.1f" % (self.minDec, self.maxDec))
-            self.logger.infoPair("Loading box size", "%.1f degrees" % self.boxSize)
-        except:
-            pass
-   
 
     '''
@@ -134,3 +89,2 @@
     def getDbUser(self, dbType): return self.settingsDoc.find(dbType +"/user").text
     def getDbPassword(self, dbType): return self.settingsDoc.find(dbType +"/password").text
-
