def course_file(request,course_key): key=Key(encoded=course_key) course=Course.get(key) course.downtimes=course.downtimes+1 course.put() response = HttpResponse(mimetype='text') response['Content-Disposition'] = 'attachment; filename='+course_key+'.cou' response.write(course.content_blob) return response