def stats_component(request, component): """Mirror public stats view for cyclades/astakos. This stats view will import the get_public_stats function of cyclades/astakos and return its results to the caller. """ admin_log(request, component=component) data = {} status = 200 if component == 'astakos': data = astakos_stats.get_public_stats() elif component == 'cyclades': data = cyclades_stats.get_public_stats() else: status = 404 return HttpResponse(json.dumps(data, cls=DjangoJSONEncoder), mimetype=JSON_MIMETYPE, status=status)
def get_public_stats(request): _stats = stats.get_public_stats() data = json.dumps(_stats) return http.HttpResponse(data, status=200, content_type='application/json')