mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	Small changes in the contribution package
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
from xml.dom import ValidationErr
 | 
			
		||||
from flask import current_app
 | 
			
		||||
from flask_wtf import FlaskForm
 | 
			
		||||
from flask_wtf.file import FileField, FileRequired
 | 
			
		||||
from wtforms import (
 | 
			
		||||
@@ -66,8 +66,9 @@ class TesseractOCRModelContributionForm(CreateContributionBaseForm):
 | 
			
		||||
    compatible_service_versions = SelectMultipleField(
 | 
			
		||||
        'Compatible service versions'
 | 
			
		||||
    )
 | 
			
		||||
    def validate_traineddata(self, field):
 | 
			
		||||
        if field.data.mimetype != '.traineddata':
 | 
			
		||||
    def validate_tesseract_model_file(self, field):
 | 
			
		||||
        current_app.logger.warning(field.data.filename)
 | 
			
		||||
        if not field.data.filename.lower().endswith('.traineddata'):
 | 
			
		||||
            raise ValidationError('traineddata files only!')
 | 
			
		||||
 | 
			
		||||
    def __init__(self, *args, **kwargs):
 | 
			
		||||
@@ -87,8 +88,9 @@ class SpacyNLPModelContributionForm(CreateContributionBaseForm):
 | 
			
		||||
    compatible_service_versions = SelectMultipleField(
 | 
			
		||||
        'Compatible service versions'
 | 
			
		||||
    )
 | 
			
		||||
    def validate_spacy(self, field):
 | 
			
		||||
        if field.data.mimetype != '.tar.gz':
 | 
			
		||||
    def validate_spacy_model_file(self, field):
 | 
			
		||||
        current_app.logger.warning(field.data.filename)
 | 
			
		||||
        if not field.data.filename.lower().endswith('.tar.gz'):
 | 
			
		||||
            raise ValidationError('.tar.gz files only!')
 | 
			
		||||
 | 
			
		||||
    def __init__(self, *args, **kwargs):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user