changeset 30:1cb439acd1e1

cross scripting
author dwinter
date Tue, 25 Sep 2012 15:57:35 +0200
parents b3428e281ee2
children ab58edfc0707
files MetaData.py
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MetaData.py	Mon Sep 17 10:14:01 2012 +0200
+++ b/MetaData.py	Tue Sep 25 15:57:35 2012 +0200
@@ -205,6 +205,20 @@
         for key,value in self.getDCMappedData(data).items():
             ret+="""<dc:%s>%s</dc:%s>"""%(key,xml.sax.saxutils.escape(value),key)
         ret+="</bib>"
+
+
+        REQUEST=self.REQUEST
+
+        if REQUEST is not None:
+            origin = REQUEST.getHeader('Origin')
+            if origin:
+                REQUEST.response.setHeader('Access-Control-Allow-Origin', origin)
+                REQUEST.response.setHeader('Access-Control-Allow-Credentials', 'true')
+            else:
+                REQUEST.response.setHeader('Access-Control-Allow-Origin', '*')
+
+            REQUEST.response.setHeader('Access-Control-Allow-Methods', 'GET, PUT, POST, DELETE, OPTIONS, HEAD')
+            REQUEST.response.setHeader('Access-Control-Allow-Headers', 'Origin, Content-Type, Cache-Control, X-Requested-With')
         
         return ret