@login_required
@one_perm_required_or_403(pr_project_private_perm,
    (Project, 'slug__exact', 'project_slug'))
def get_translation_file(request, project_slug, resource_slug, lang_code):

    resource = get_object_or_404(Resource, project__slug = project_slug,
        slug = resource_slug)

    language = get_object_or_404(Language, code=lang_code)

    try:
        fb = FormatsBackend(resource, language)
        template = fb.compile_translation()
    except Exception, e:
        messages.error(request,
                       _("Error compiling translation file."))
        logger.error("Error compiling '%s' file for '%s': %s" % (language,
            resource, str(e)))
        return HttpResponseRedirect(reverse('resource_detail',
            args=[resource.project.slug, resource.slug]),)

    response = HttpResponse(
        template, mimetype=registry.mimetypes_for(resource.i18n_method)[0]
    )
    _filename = "%(proj)s_%(res)s_%(lang)s%(type)s" % {
        'proj': smart_unicode(resource.project.slug),
        'res': smart_unicode(resource.slug),
        'lang': language.code,
        'type': registry.file_extension_for(resource, language)
    }
    response['Content-Disposition'] = ('attachment; filename=%s' % _filename)
    return response


# Restrict access only for private projects
# DONT allow anonymous access
Calculate the posterior log probability of the samples X
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/resources/views.py/get_translation_file--crossover with--dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/naive_bayes.py/BernoulliNB._joint_log_likelihood