# HG changeset patch # User casties # Date 1282236950 -7200 # Node ID 860ec92f99df0e42c2112c55f690beda048a33b6 # Parent 1a4b56716902a3b1357a7a0a84ec9f53e0defd95 added cross-site access header (for GET) diff -r 1a4b56716902 -r 860ec92f99df RestDbInterface.py --- 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()