diff documentViewer.py @ 622:bc68ca0d2c0a

make annotationServerUrl work with protocol-relative URL (//).
author casties
date Fri, 12 Dec 2014 16:27:58 +0100
parents 54d3498a6e78
children 6012fe93f78c
line wrap: on
line diff
--- a/documentViewer.py	Thu Dec 11 17:24:21 2014 +0100
+++ b/documentViewer.py	Fri Dec 12 16:27:58 2014 +0100
@@ -1161,6 +1161,15 @@
     def getAnnotatorGroupsForUser(self, user, annotationServerUrl="http://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager"):
         """returns list of groups {name:*, id:*} on the annotation server for the user"""
         groups = []
+        if annotationServerUrl.startswith('//'):
+            # add matching http(s) from our URL
+            myUrl = self.REQUEST['URL']
+            logging.debug("my URL: %s"%myUrl)
+            if myUrl.startswith('https:'):
+                annotationServerUrl = "https:%s"%annotationServerUrl
+            else:
+                annotationServerUrl = "http:%s"%annotationServerUrl
+            
         groupsUrl = "%s/annotator/groups?user=%s"%(annotationServerUrl,user)
         data = getHttpData(url=groupsUrl, noExceptions=True)
         if data: