Mercurial > hg > documentViewer
comparison 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 |
comparison
equal
deleted
inserted
replaced
621:a7b287122ce8 | 622:bc68ca0d2c0a |
---|---|
1159 | 1159 |
1160 | 1160 |
1161 def getAnnotatorGroupsForUser(self, user, annotationServerUrl="http://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager"): | 1161 def getAnnotatorGroupsForUser(self, user, annotationServerUrl="http://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager"): |
1162 """returns list of groups {name:*, id:*} on the annotation server for the user""" | 1162 """returns list of groups {name:*, id:*} on the annotation server for the user""" |
1163 groups = [] | 1163 groups = [] |
1164 if annotationServerUrl.startswith('//'): | |
1165 # add matching http(s) from our URL | |
1166 myUrl = self.REQUEST['URL'] | |
1167 logging.debug("my URL: %s"%myUrl) | |
1168 if myUrl.startswith('https:'): | |
1169 annotationServerUrl = "https:%s"%annotationServerUrl | |
1170 else: | |
1171 annotationServerUrl = "http:%s"%annotationServerUrl | |
1172 | |
1164 groupsUrl = "%s/annotator/groups?user=%s"%(annotationServerUrl,user) | 1173 groupsUrl = "%s/annotator/groups?user=%s"%(annotationServerUrl,user) |
1165 data = getHttpData(url=groupsUrl, noExceptions=True) | 1174 data = getHttpData(url=groupsUrl, noExceptions=True) |
1166 if data: | 1175 if data: |
1167 res = json.loads(data) | 1176 res = json.loads(data) |
1168 rows = res.get('rows', None) | 1177 rows = res.get('rows', None) |