Exemple #1
0
def retrieve_licenses(request):
    try:
        type_ = int(request.REQUEST['public_access'])
        licenses = License.get_suitable_licenses(type_)
    except KeyError:
        licenses = License.get_suitable_licenses()
    return HttpResponse(json.dumps([model_to_dict(x) for x in licenses]))
Exemple #2
0
def retrieve_licenses(request):
    try:
        type_ = int(request.REQUEST['public_access'])
        licenses = License.get_suitable_licenses(type_)
    except KeyError:
        licenses = License.get_suitable_licenses()
    return HttpResponse(json.dumps([model_to_dict(x) for x in licenses]))
Exemple #3
0
    def clean(self):
        cleaned_data = super(RightsForm, self).clean()
        public_access = cleaned_data.get("public_access")
        license_ = cleaned_data.get("license")

        if license_ is None:
            # Only data which is not distributed can have no explicit licence
            suitable = not Experiment.public_access_implies_distribution(public_access)
        else:
            suitable = license_ in License.get_suitable_licenses(public_access)

        if not suitable:
            raise forms.ValidationError("Selected license it not suitable " + "for public access level.")

        return cleaned_data
Exemple #4
0
    def clean(self):
        cleaned_data = super(RightsForm, self).clean()
        public_access = cleaned_data.get("public_access")
        license_ = cleaned_data.get("license")

        if license_ is None:
            # Only data which is not distributed can have no explicit licence
            suitable = not \
                Experiment.public_access_implies_distribution(public_access)
        else:
            suitable = license_ in License.get_suitable_licenses(public_access)

        if not suitable:
            raise forms.ValidationError("Selected license it not suitable " +
                                        "for public access level.")

        return cleaned_data