def service_cmd(response, service): o = {"success": False} if response.META.get("HTTP_X_REQUESTED_WITH") == "XMLHttpRequest": s = services.init() output = s.service_command(service, response.POST["action"]) o["msg"] = output[1] if output[0]: o["success"] = True return HttpResponse(simplejson.dumps(o))
def servicesinfo(response, template_name): s = services.init() o = {"info": s.get_services()} return render_to_response(template_name, o, context_instance=RequestContext(response))