def put(self, request, *args, **kwargs): user_agent = request.META['HTTP_USER_AGENT'] output_id = int(self.kwargs.get("output_id", 0)) output = CITaskStepOutput.objects.get(output_id) if output: if 'MAC' in user_agent.upper(): FileInfoService.create_package_plist(output.id) # FileInfoService.create_package_file(output.id) package = WEB_HOST.replace( 'http', 'https') + "/static/plist_files/" + str( output.id) + ".plist" else: package = WEB_HOST + "/api/ci/task/output/" + str( output_id) + "/download" return Response({"package_url": package})
def mobile_download_page(request): user_agent=request.META['HTTP_USER_AGENT'] host=request.META['HTTP_HOST'] file_id=request.GET.get('file_id',0) history_id=request.GET.get('history_id',0) os_name="Android" android=True if 'MAC' in user_agent.upper(): FileInfoService.create_package_plist(file_id,history_id) FileInfoService.create_package_file(file_id) package=WEB_HOST.replcae("http","https")+"/static/plist_files/"+str(file_id)+".plist" os_name="iPhone" android=False else: package=WEB_HOST+"/ci/history/"+str(file_id)+"/download_package" page_fileds={'package':package,"os_name":os_name,'android':android} return render_to_response('task_history/ci_mobile_package_download.html',page_fileds)