Index: trunk/ippToPsps/jython/scratchdb.py
===================================================================
--- trunk/ippToPsps/jython/scratchdb.py	(revision 33236)
+++ trunk/ippToPsps/jython/scratchdb.py	(revision 33259)
@@ -19,6 +19,6 @@
     Constructor
     '''
-    def __init__(self, logger, doc, useFull=0):
-        super(ScratchDb, self).__init__(logger, doc, "localdatabase")
+    def __init__(self, logger, config, useFull=0):
+        super(ScratchDb, self).__init__(logger, config, "localdatabase")
 
         if useFull:
@@ -484,9 +484,23 @@
 
     '''
-    Gets a list of PSPS image IDs for this stack ID
-    '''
-    def getDvoRegionsForThisBox(self, minRa, maxRa, minDec, maxDec):
+    Gets a list of DVO regions that overlap with the defined box
+    '''
+    def getDvoRegions(self, minRa, maxRa, minDec, maxDec):
 
         self.logger.debug("Querying DVO SkyTable for FITS files in this region")
+
+        regions = []
+        self.getDvoRegionsForThisBox(regions, minRa, maxRa, minDec, maxDec)
+
+        # deal with 0/360 boundary
+        if minRa < 0: self.getDvoRegionsForThisBox(regions, minRa + 360, 361 ,minDec, maxDec)
+        if maxRa > 360: self.getDvoRegionsForThisBox(regions, 0, maxRa - 360 ,minDec, maxDec)
+
+        return regions
+
+    '''
+    Gets a list of DVO regions that overlap with the defined box
+    '''
+    def getDvoRegionsForThisBox(self, regions, minRa, maxRa, minDec, maxDec):
 
         sql = "SELECT name FROM " + self.dvoSkyTable + " \
@@ -498,13 +512,8 @@
         try:
             rs = self.executeQuery(sql)
-        except:
-            self.logger.exception("Can't query for imageIDs")
-
-        files = []
-        while (rs.next()):
-            files.append(rs.getString(1))
-        rs.close()
-
-        return files
-
-
+            while (rs.next()): regions.append(rs.getString(1))
+            rs.close()
+        except:
+            self.logger.exception("Can't query for DVO regions")
+
+
