Coverage for runmacs/processor/frontend/tools.py : 43%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*- # Filename: tools.py frontendServer - render macsServer database to web page =======================================================
Copyright (C) 2013 Tobias Kölling """
'macsserver.physik.lmu.de']
return self.serverPrefix + "/static/" + fn self.protocol = 'https' self.dap_requires_key = True else: {'target': self.serverPrefix + '/aligned.html', 'name': 'Aligned',}, {'target': self.serverPrefix + '/polar.html', 'name': 'Polar',}, {'target': self.serverPrefix + '/equi.html', 'name': 'Equirectangular',}] else: self.set_status(304) return True else:
kwargs['staticFile'] = self.staticFile kwargs['prefix'] = self.serverPrefix kwargs['nav'] = self.nav kwargs['protocol'] = self.protocol kwargs['host'] = self.host kwargs['urlprefix'] = self.urlprefix kwargs['current_user'] = self.current_user kwargs['special_rights'] = self.special_rights kwargs['dap_requires_key'] = self.dap_requires_key return super(RequestHandler, self).render(*args, **kwargs) def current_user(self): headers = self.request.headers if 'X-Varnish' in headers: return self.request.headers.get('X-Auth-User', None) else: return None def current_roles(self): return self.request.headers.get('X-Auth-Roles', '').split() else: def current_rights(self): if self._current_rights is None: rolesCollection = self.settings['authDB'].roles if rolesCollection is None: return None rights = list(rolesCollection.find({'name': {'$in': self.current_roles}})) specialRights = [] for r in rights: specialRights += r.get('special', []) queryRestrictions = [] for r in rights: try: queryRestrictions.append(json.loads(r['queryRestriction'])) except KeyError: continue self._current_rights = {'special': specialRights, 'queryRestrictions': parse_dates_in_tree(queryRestrictions)} return self._current_rights def special_rights(self): current_rights = self.current_rights if current_rights is None: return [] return current_rights.get('special', []) self.set_status(403)
info = {} info['hasCoordinates'] = pt in ('aligned_image', 'projected_image') if pt in ('mount_position', 'window_transmission', 'aircraft_positions'): info['needPreviewCache'] = False info['previewExtension'] = 'png' else: info['needPreviewCache'] = True info['previewExtension'] = 'jpg' return info
d[k] = v return d |