Jachym Cepicky преди 14 години
родител
ревизия
5b971cd555
променени са 6 файла, в които са добавени 17 реда и са изтрити 39 реда
  1. 6 7
      OWS.py
  2. 1 22
      __init__.py
  3. 4 4
      owsproxy.cgi-template
  4. 2 2
      wcs/__init__.py
  5. 2 2
      wfs/__init__.py
  6. 2 2
      wms/__init__.py

+ 6 - 7
OWS.py

@@ -40,9 +40,8 @@ class OWS:
         if qstring:
             self.qstring = qstring
 
-        configFiles = [
-                os.path.join(os.path.dirname(__file__),"config.cfg")
-                ]
+        configFiles = [ os.path.join(os.path.dirname(__file__),"config.cfg") ]
+
         if sys.platform == "win32":
             pass # TODO Default conf. file on windows platform
         elif sys.platform == "linux2":
@@ -286,7 +285,7 @@ class OWS:
         # layerobj.metadata.get("wfs_filter") is still fine
         
 
-def getService():
+def getService(configFile=None):
 
     qstring = os.environ["QUERY_STRING"]
     params = urlparse.parse_qs(qstring)
@@ -310,13 +309,13 @@ def getService():
         if params["owsService"][0].lower() == "wfs":
             from wfs import WFS
             logging.debug("OWS.py::getService()::owsUrl: '%s'" % owsUrl)
-            return WFS(owsUrl,qstring)
+            return WFS(owsUrl,qstring,configFile = configFile )
         elif params["owsService"][0].lower() == "wcs":
             from wcs import WCS
-            return WCS(owsUrl,qstring)
+            return WCS(owsUrl,qstring, configFile = configFile)
         elif params["owsService"][0].lower() == "wms":
             from wms import WMS
-            return WMS(owsUrl,qstring)
+            return WMS(owsUrl,qstring, configFile = configFile)
     else:
         raise OWSExceptions.MissingParameterValue("""owsUrl or owsService""")
     

+ 1 - 22
__init__.py

@@ -1,22 +1 @@
-import urllib
-import tempfile
-import ConfigParser 
-
-DEFAULT_CONFIGS={}
-
-class OWSViewer:
-    workingDir = None
-    config = None
-
-    def __init__(self,configFiles):
-        config = ConfigParser.ConfigParser()
-        config.read(configFiles)
-
-        self.workingDir = tempfile.mkdtemp(prefix="owsviewer",dir=config.get("server","tempdir",vars=DEFAULT_CONFIGS))
-        
-    def getImage(self,url,targetFormat="image/png"):
-        pass
-
-        
-
-
+__all__ = [ "OWS","wcs","wfs","wms","OWSException"]

+ 4 - 4
owsproxy.cgi → owsproxy.cgi-template

@@ -3,17 +3,17 @@
 #debugger
 #import rpdb2; rpdb2.start_embedded_debugger("lucerna")
 
+# import sys
+# sys.path.append("/path/to/owsproxy/")
+
 import OWS
 import logging
 import OWSExceptions
 
-#debugger
-#import rpdb2; rpdb2.start_embedded_debugger("lucerna")
-
 logging.basicConfig(level=logging.DEBUG)
 
 try:
-    service = OWS.getService()
+    service = OWS.getService(configFile = "config.cfg")
     service.dispatch()
 except OWSExceptions.OWSException,e:
     e.toXml()

+ 2 - 2
wcs/__init__.py

@@ -17,8 +17,8 @@ class WCS(OWS):
     parser = None
     version = None
 
-    def __init__(self,url=None,qstring=None,configFiles=None):
-        OWS.__init__(self,url,qstring)
+    def __init__(self,url=None,qstring=None,configFile=None):
+        OWS.__init__(self,url,qstring,configFile)
 
     def makeMap(self,mapfilename=None):
         """Create mapscript.mapObj"""

+ 2 - 2
wfs/__init__.py

@@ -20,8 +20,8 @@ class WFS(OWS):
     layerDefFile = None
     lyrobj = None
 
-    def __init__(self,url=None,qstring=None,configFiles=None):
-        OWS.__init__(self,url,qstring)
+    def __init__(self,url=None,qstring=None,configFile=None):
+        OWS.__init__(self,url,qstring,configFile)
 
     def makeMap(self,mapfilename=None):
 

+ 2 - 2
wms/__init__.py

@@ -17,8 +17,8 @@ class WMS(OWS):
     parser = None
     version = None
 
-    def __init__(self,url=None,qstring=None,configFiles=None):
-        OWS.__init__(self,url,qstring)
+    def __init__(self,url=None,qstring=None,configFile=None):
+        OWS.__init__(self,url,qstring,configFile)
 
     def makeMap(self,mapfilename=None):
         """Create mapscript.mapObj"""