def nearest_sale_locations(request): try: data = json.loads(request.GET['data']) except: return HttpResponseBadRequest('Missing or invalid JSON in POST data') try: start = short_system_name(SYSTEM_NAMES[data['sid']]) except: return JsonResponse({'result': 'failure', 'error': 'Start system not found'}) try: sales = sale_locations(data) except ValueError, e: return JsonResponse({'result': 'failure', 'error': str(e)})
def nearest_sale_locations(request): try: data = json.loads(request.GET["data"]) except: return HttpResponseBadRequest("Missing or invalid JSON in POST data") try: start = short_system_name(SYSTEM_NAMES[data["sid"]]) except: return JsonResponse({"result": "failure", "error": "Start system not found"}) try: sales = sale_locations(data) except ValueError, e: return JsonResponse({"result": "failure", "error": str(e)})
def sector(s): point = Point(s.x, s.y) system = short_system_name(SYSTEM_NAMES[s.sid]) return Sector(system, point)
def sector(s, x, y): point = Point(x, y) system = short_system_name(SYSTEM_NAMES[s]) return Sector(system, point)
def short_system(self): """Returns the short string name of the system. """ return short_system_name(self.system())