123456789101112131415161718192021 |
- def validate_plupload(request, pub_name, file_name, labelsContent):
- file_name = os.path.basename(file_name).strip().replace(" ", "_")
- if pub_name == "BED":
- # validate bed file name is unique
- if models.Content.objects.filter(file__endswith="/" + file_name).count() > 0:
- raise Exception(
- validation.invalid_entity_field_unique_value(
- labelsContent.verbose_name,
- labelsContent.pickfile.verbose_name,
- file_name,
- )
- )
- # validate file name
- if not validation.is_valid_chars(file_name):
- raise Exception(validation.invalid_chars_error("BED file name"))
- return file_name
|