changeset 23:860ec92f99df

added cross-site access header (for GET)
author casties
date Thu, 19 Aug 2010 18:55:50 +0200
parents 1a4b56716902
children f3811d9a36da
files RestDbInterface.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/RestDbInterface.py	Thu Aug 19 14:30:51 2010 +0200
+++ b/RestDbInterface.py	Thu Aug 19 18:55:50 2010 +0200
@@ -184,10 +184,6 @@
         format = REQUEST.get('format','HTML').upper()
         type = REQUEST.get('type',None)
         
-        # id and doc are used for GoogleMaps content
-        id = REQUEST.get('id',[])           
-        doc = REQUEST.get('doc',None)
-       
         logging.debug("index_html path=%s format=%s type=%s"%(path,format,type))
 
         if type is not None:
@@ -249,8 +245,12 @@
     def showTable(self,format='XML',schema='public',table=None,REQUEST=None,RESPONSE=None):
         """returns PageTemplate with tables"""
         logging.debug("showtable")
+        # should be cross-site accessible 
+        RESPONSE.setHeader('Access-Control-Allow-Origin', '*')
         # GIS gets special treatment
         if format=="GIS":
+            id = REQUEST.get('id',[])           
+            doc = REQUEST.get('doc',None)
             return self.showGoogleMap(schema=path[1],table=path[2],id=id,doc=doc)
 
         # JSON gets special treatment
@@ -277,6 +277,8 @@
     def showListOfTables(self,format='XML',schema='public',REQUEST=None,RESPONSE=None):
         """returns PageTemplate with list of tables"""
         logging.debug("showlistoftables")
+        # should be cross-site accessible 
+        RESPONSE.setHeader('Access-Control-Allow-Origin', '*')
         # JSON gets special treatment
         if format == "JSON":
             data = self.getListOfTables(schema)
@@ -307,6 +309,8 @@
     def showListOfSchemas(self,format='XML',REQUEST=None,RESPONSE=None):
         """returns PageTemplate with list of schemas"""
         logging.debug("showlistofschemas")
+        # should be cross-site accessible 
+        RESPONSE.setHeader('Access-Control-Allow-Origin', '*')
         # JSON gets special treatment
         if format == "JSON":
             data = self.getListOfSchemas()