Commit d91949ef authored by Willem ter Berg's avatar Willem ter Berg

code cleanup

parent 240fe8d2
......@@ -178,7 +178,8 @@ def update_schema(schema):
'source_catalog': [recommended, donl_catalogs, to_extras],
'language': [mandatory, to_list_if_curly_string, donl_languages, to_extras],
'metadata_language': [mandatory, donl_language, to_extras],
'theme': [mandatory, to_list_if_curly_string, overheid_taxonomiebeleidsagenda, to_extras],
'theme': [mandatory, to_list_if_curly_string,
overheid_taxonomiebeleidsagenda, to_extras],
'changetype': [adms_changetype, to_extras],
'contact_point_email': [recommended, is_string, to_extras],
'contact_point_address': [recommended, is_string, to_extras],
......
......@@ -2,26 +2,30 @@
import unittest
def mock_ckan():
import sys
class ckan_plugins_toolkit_invalid(Exception):
class CkanPluginsToolkitInvalid(Exception):
pass
class ckan_plugins_toolkit(object):
Invalid = ckan_plugins_toolkit_invalid
class ckan_plugins(object):
toolkit = ckan_plugins_toolkit
class ckan(object):
plugins = ckan_plugins
sys.modules['ckan'] = ckan
sys.modules['ckan.plugins'] = ckan_plugins
sys.modules['ckan.plugins.toolkit'] = ckan_plugins_toolkit
class CkanPluginsToolkit(object):
Invalid = CkanPluginsToolkitInvalid
class CkanPlugins(object):
toolkit = CkanPluginsToolkit
class Ckan(object):
plugins = CkanPlugins
sys.modules['ckan'] = Ckan
sys.modules['ckan.plugins'] = CkanPlugins
sys.modules['ckan.plugins.toolkit'] = CkanPluginsToolkit
def run_tests():
from validator.test_changetype_validator import TestChangetypeValidator
from validator.test_contact_point_validator import TestContactPointValidator
from validator.test_hash_validator import TestHashValidatior
from validator.test_hash_validator import TestHashValidator
from validator.test_legal_foundation_validator import TestLegalFoundationValidator
from validator.test_spatial_validator import TestSpatialValidator
from validator.test_temporal_validator import TestTemporalValidator
......@@ -32,7 +36,7 @@ def run_tests():
tests = {
'ChangetypeValidator': unittest.TestLoader().loadTestsFromTestCase(TestChangetypeValidator),
'ContactPointValidator': unittest.TestLoader().loadTestsFromTestCase(TestContactPointValidator),
'HashValidator': unittest.TestLoader().loadTestsFromTestCase(TestHashValidatior),
'HashValidator': unittest.TestLoader().loadTestsFromTestCase(TestHashValidator),
'LegalFoundationValidator': unittest.TestLoader().loadTestsFromTestCase(TestLegalFoundationValidator),
'SpatialValidator': unittest.TestLoader().loadTestsFromTestCase(TestSpatialValidator),
'TemporalValidator': unittest.TestLoader().loadTestsFromTestCase(TestTemporalValidator),
......
......@@ -3,6 +3,7 @@
import unittest
import ckanext.dcatdonl.validator.changetype_validator as changetype_validator
class TestChangetypeValidator(unittest.TestCase):
def test_that_changetype_is_set_to_created(self):
......@@ -35,5 +36,6 @@ class TestChangetypeValidator(unittest.TestCase):
self.assertEqual(validation_result[2], errors)
self.assertEqual(validation_result[3], context)
if __name__ == '__main__':
unittest.main()
# encoding: utf-8
import unittest
import ckanext.dcatdonl.validator.contact_point_validator as contact_point_validator
import ckanext.dcatdonl.validator.contact_point_validator as cp_validator
class TestContactPointValidator(unittest.TestCase):
......@@ -19,7 +20,7 @@ class TestContactPointValidator(unittest.TestCase):
}
context = {}
validation_result = contact_point_validator.valid_contact_point(key, data_dict, errors, context)
validation_result = cp_validator.valid_contact_point(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
......@@ -39,7 +40,7 @@ class TestContactPointValidator(unittest.TestCase):
}
context = {}
validation_result = contact_point_validator.valid_contact_point(key, data_dict, errors, context)
validation_result = cp_validator.valid_contact_point(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
......@@ -58,7 +59,7 @@ class TestContactPointValidator(unittest.TestCase):
}
context = {}
validation_result = contact_point_validator.valid_contact_point(key, data_dict, errors, context)
validation_result = cp_validator.valid_contact_point(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
......@@ -75,7 +76,7 @@ class TestContactPointValidator(unittest.TestCase):
}
context = {}
validation_result = contact_point_validator.valid_contact_point(key, data_dict, errors, context)
validation_result = cp_validator.valid_contact_point(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
......
......@@ -4,7 +4,7 @@ import unittest
import ckanext.dcatdonl.validator.hash_validator as hash_validator
class TestHashValidatior(unittest.TestCase):
class TestHashValidator(unittest.TestCase):
def test_no_changes_when_keys_absent(self):
"""
......@@ -46,7 +46,8 @@ class TestHashValidatior(unittest.TestCase):
def test_new_error_when_hash_is_present_but_algorithm_is_not(self):
"""
Assert that an error is thrown when the hash key is present and not empty while the hash_algorithm key is absent.
Assert that an error is thrown when the hash key is present and not empty while the
hash_algorithm key is absent.
:return: void
"""
......@@ -74,7 +75,8 @@ class TestHashValidatior(unittest.TestCase):
def test_new_error_when_hash_algorithm_is_present_but_hash_is_not(self):
"""
Assert that an error is thrown when the hash_algorithm key is present while the hash key is absent.
Assert that an error is thrown when the hash_algorithm key is present while the hash key is
absent.
:return: void
"""
......
# encoding: utf-8
import unittest
import ckanext.dcatdonl.validator.legal_foundation_validator as legal_foundation_validator
import ckanext.dcatdonl.validator.legal_foundation_validator as lf_validator
class TestLegalFoundationValidator(unittest.TestCase):
......@@ -12,7 +12,7 @@ class TestLegalFoundationValidator(unittest.TestCase):
errors = {}
context = {}
validation_result = legal_foundation_validator.valid_legal_foundation(key, data_dict, errors, context)
validation_result = lf_validator.valid_legal_foundation(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
......@@ -29,7 +29,7 @@ class TestLegalFoundationValidator(unittest.TestCase):
}
context = {}
validation_result = legal_foundation_validator.valid_legal_foundation(key, data_dict, errors, context)
validation_result = lf_validator.valid_legal_foundation(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
......@@ -49,12 +49,13 @@ class TestLegalFoundationValidator(unittest.TestCase):
}
context = {}
validation_result = legal_foundation_validator.valid_legal_foundation(key, data_dict, errors, context)
validation_result = lf_validator.valid_legal_foundation(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
self.assertEqual(validation_result[2], {
('legal_foundation_ref',): ['legal_foundation_ref must be provided when providing any of the legal_foundation_% properties'],
('legal_foundation_ref',): ['legal_foundation_ref must be provided when providing any '
'of the legal_foundation_% properties'],
('legal_foundation_uri', ): [],
('legal_foundation_label',): []
})
......@@ -73,12 +74,13 @@ class TestLegalFoundationValidator(unittest.TestCase):
}
context = {}
validation_result = legal_foundation_validator.valid_legal_foundation(key, data_dict, errors, context)
validation_result = lf_validator.valid_legal_foundation(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
self.assertEqual(validation_result[2], {
('legal_foundation_uri',): ['legal_foundation_uri must be provided when providing any of the legal_foundation_% properties'],
('legal_foundation_uri',): ['legal_foundation_uri must be provided when providing any '
'of the legal_foundation_% properties'],
('legal_foundation_ref', ): [],
('legal_foundation_label',): []
})
......@@ -97,16 +99,18 @@ class TestLegalFoundationValidator(unittest.TestCase):
}
context = {}
validation_result = legal_foundation_validator.valid_legal_foundation(key, data_dict, errors, context)
validation_result = lf_validator.valid_legal_foundation(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
self.assertEqual(validation_result[2], {
('legal_foundation_label',): ['legal_foundation_label must be provided when providing any of the legal_foundation_% properties'],
('legal_foundation_label',): ['legal_foundation_label must be provided when providing '
'any of the legal_foundation_% properties'],
('legal_foundation_uri', ): [],
('legal_foundation_ref',): []
})
self.assertEqual(validation_result[3], context)
if __name__ == '__main__':
unittest.main()
# encoding: utf-8
import unittest
import ckanext.dcatdonl.validator.spatial_validator as spatial_validator
import ckanext.dcatdonl.validator.spatial_validator as s_validator
class TestSpatialValidator(unittest.TestCase):
......@@ -17,7 +17,7 @@ class TestSpatialValidator(unittest.TestCase):
]
for coordinate in valid_coordinates:
self.assertTrue(spatial_validator.valid_epsg28992(coordinate))
self.assertTrue(s_validator.valid_epsg28992(coordinate))
def test_invalid_coordinates(self):
invalid_coordinates = [
......@@ -29,7 +29,7 @@ class TestSpatialValidator(unittest.TestCase):
]
for coordinate in invalid_coordinates:
self.assertFalse(spatial_validator.valid_epsg28992(coordinate))
self.assertFalse(s_validator.valid_epsg28992(coordinate))
def test_valid_postcodehuisnummer(self):
valid_postcodehuisnummers = [
......@@ -40,7 +40,7 @@ class TestSpatialValidator(unittest.TestCase):
]
for postcodehuisnummer in valid_postcodehuisnummers:
self.assertTrue(spatial_validator.valid_postcodehuisnummer(postcodehuisnummer))
self.assertTrue(s_validator.valid_postcodehuisnummer(postcodehuisnummer))
def test_invalid_postcodehuisnummer(self):
invalid_postcodehuisnummers = [
......@@ -51,7 +51,8 @@ class TestSpatialValidator(unittest.TestCase):
]
for postcodehuisnummer in invalid_postcodehuisnummers:
self.assertFalse(spatial_validator.valid_postcodehuisnummer(postcodehuisnummer), postcodehuisnummer)
self.assertFalse(s_validator.valid_postcodehuisnummer(postcodehuisnummer),
postcodehuisnummer)
def test_no_changes_when_no_values_are_present(self):
key = ('package', 0, 'spatial_scheme')
......@@ -59,7 +60,7 @@ class TestSpatialValidator(unittest.TestCase):
errors = {}
context = {}
validation_result = spatial_validator.valid_spatial(key, data_dict, errors, context)
validation_result = s_validator.valid_spatial(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
......@@ -77,7 +78,7 @@ class TestSpatialValidator(unittest.TestCase):
}
context = {}
validation_result = spatial_validator.valid_spatial(key, data_dict, errors, context)
validation_result = s_validator.valid_spatial(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
......@@ -97,12 +98,13 @@ class TestSpatialValidator(unittest.TestCase):
}
context = {}
validation_result = spatial_validator.valid_spatial(key, data_dict, errors, context)
validation_result = s_validator.valid_spatial(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
self.assertEqual(validation_result[2], {
('spatial_value',): ['spatial_value cannot be validated without a corresponding spatial_scheme'],
('spatial_value',): ['spatial_value cannot be validated without a corresponding '
'spatial_scheme'],
('spatial_scheme',): []
})
self.assertEqual(validation_result[3], context)
......@@ -120,7 +122,7 @@ class TestSpatialValidator(unittest.TestCase):
}
context = {}
validation_result = spatial_validator.valid_spatial(key, data_dict, errors, context)
validation_result = s_validator.valid_spatial(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
......@@ -146,7 +148,7 @@ class TestSpatialValidator(unittest.TestCase):
}
context = {}
validation_result = spatial_validator.valid_spatial(key, data_dict, errors, context)
validation_result = s_validator.valid_spatial(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
......@@ -169,7 +171,7 @@ class TestSpatialValidator(unittest.TestCase):
}
context = {}
validation_result = spatial_validator.valid_spatial(key, data_dict, errors, context)
validation_result = s_validator.valid_spatial(key, data_dict, errors, context)
self.assertEqual(validation_result[0], key)
self.assertEqual(validation_result[1], data_dict)
......
# encoding: utf-8
import unittest
import ckanext.dcatdonl.validator.temporal_validator as temporal_validator
class TestTemporalValidator(unittest.TestCase):
......
......@@ -14,9 +14,9 @@ class TestTypeValidator(unittest.TestCase):
def test_no_error_on_unicode_value(self):
expected = u'myUnicodeString'
input = u'myUnicodeString'
inp = u'myUnicodeString'
self.assertEqual(type_validator.is_string(input), expected)
self.assertEqual(type_validator.is_string(inp), expected)
def test_no_error_on_string_value(self):
expected = 'myString'
......@@ -43,8 +43,8 @@ class TestTypeValidator(unittest.TestCase):
self.assertTrue('value must be a dictionary' in context.exception)
def test_no_error_on_dict_value(self):
expected = { 'a': 'b' }
input_value = { 'a': 'b' }
expected = {'a': 'b'}
input_value = {'a': 'b'}
self.assertEqual(type_validator.is_dictionary(input_value), expected)
......
# encoding: utf-8
import unittest
import ckanext.dcatdonl.validator.uri_validator as uri_validator
class TestURIValidator(unittest.TestCase):
......
# encoding: utf-8
import unittest
import ckanext.dcatdonl.validator.valuelist_validator as valuelist_validator
class TestValuelistValidator(unittest.TestCase):
......
......@@ -4,6 +4,7 @@
Module that applies the ADMS:Changetype property to a dataset.
"""
def changetype_created(key, data, errors, context):
"""
Applies the ADMS:Changetype ':created'
......
......@@ -4,6 +4,7 @@
Module that provides complex validation on a contact_point of a dataset.
"""
def valid_contact_point(key, data, errors, context):
"""
Validates the provided contact_point of a dataset.
......@@ -14,9 +15,16 @@ def valid_contact_point(key, data, errors, context):
:param context: dict, argument to match CKAN method signature, not used
:return: (key, data, errors, context), the original arguments, possibly modified
"""
if not ('contact_point_website',) in data and not ('contact_point_email',) in data and not ('contact_point_phone',) in data:
errors[('contact_point_website',)].append('website, email or phone is required for the contact_point')
errors[('contact_point_email',)].append('website, email or phone is required for the contact_point')
errors[('contact_point_phone',)].append('website, email or phone is required for the contact_point')
properties = [
('contact_point_website',),
('contact_point_email',),
('contact_point_phone',)
]
properties_present = (prop in data for prop in properties)
error_message = 'website, email or phone is required for the contact_point'
if not any(properties_present):
for prop in properties:
errors[prop].append(error_message)
return key, data, errors, context
......@@ -4,6 +4,7 @@
Module that provides complex validation for the hash of a resource.
"""
def valid_hash(key, data, errors, context):
"""
Validates the provided hash of a dataset.
......
......@@ -4,6 +4,7 @@
Module that provides complex validation for a datasets legal_foundation.
"""
def valid_legal_foundation(key, data, errors, context):
"""
Validates the provided legal_foundation of a dataset.
......@@ -24,12 +25,13 @@ def valid_legal_foundation(key, data, errors, context):
if any(have_errors):
return key, data, errors, context
absentees = (t for t in tuples if not t in data)
absentees = (t for t in tuples if t not in data)
for absentee in absentees:
if not errors[absentee]:
errors[absentee] = []
errors[absentee].append(absentee[0] + ' must be provided when providing any of the legal_foundation_% properties')
errors[absentee].append(absentee[0] + ' must be provided when providing any of the '
'legal_foundation_* properties')
return key, data, errors, context
......@@ -4,6 +4,7 @@
Provides complex rights validation for a DCAT-AP-DONL dataset.
"""
def validate_stated_rights(key, data_dict, errors, context):
"""
Validates that the various rights statements do not conflict each other.
......@@ -15,23 +16,33 @@ def validate_stated_rights(key, data_dict, errors, context):
:return: (key, data, errors, context), the original arguments, possibly modified
"""
non_open_licenses = [
{ 'id': 'http://standaarden.overheid.nl/owms/terms/geslotenlicentie' },
{ 'id': 'http://standaarden.overheid.nl/owms/terms/licentieonbekend' }
{'id': 'http://standaarden.overheid.nl/owms/terms/geslotenlicentie'},
{'id': 'http://standaarden.overheid.nl/owms/terms/licentieonbekend'}
]
status_available = data_dict.get(('dataset_status',), None) == 'http://data.overheid.nl/status/beschikbaar'
status_closed = data_dict.get(('dataset_status',), None) == 'http://data.overheid.nl/status/niet beschikbaar'
access_rights_public = data_dict.get(('access_rights',), None) == 'http://publications.europa.eu/resource/authority/access-right/PUBLIC'
access_rights_restricted = data_dict.get(('access_rights',), None) == 'http://publications.europa.eu/resource/authority/access-right/RESTRICTED'
license_is_open = data_dict.get(('license',), None) not in non_open_licenses
status = data_dict.get(('dataset_status',), None)
access_rights = data_dict.get(('access_rights',), None)
license = data_dict.get(('license',), None)
status_available = status == 'http://data.overheid.nl/status/beschikbaar'
status_closed = status == 'http://data.overheid.nl/status/niet_beschikbaar'
access_rights_public = access_rights == 'http://publications.europa.eu/resource/authority/access-right/PUBLIC'
access_rights_restricted = access_rights == 'http://publications.europa.eu/resource/authority/access-right/RESTRICTED'
license_is_open = license not in non_open_licenses
if status_available and access_rights_public and not license_is_open:
errors[('license',)] = ['An open license must be provided when dataset_status is [http://data.overheid.nl/status/beschikbaar] and access_rights is [http://publications.europa.eu/resource/authority/access-right/PUBLIC]']
errors[('license',)] = ['An open license must be provided when dataset_status is '
'[http://data.overheid.nl/status/beschikbaar] and access_rights '
'is [http://publications.europa.eu/resource/authority/access-right/PUBLIC]']
if status_available and not license_is_open and not access_rights_restricted:
errors[('access_rights',)] = ['access_rights must be [http://publications.europa.eu/resource/authority/access-right/RESTRICTED] when status is [http://data.overheid.nl/status/beschikbaar] and a non-open license is provided']
errors[('access_rights',)] = ['access_rights must be '
'[http://publications.europa.eu/resource/authority/access-right/RESTRICTED] '
'when status is [http://data.overheid.nl/status/beschikbaar] '
'and a non-open license is provided']
if status_closed and license_is_open:
errors[('license',)] = ['cannot provide an open license when dataset_status is [http://data.overheid.nl/status/niet beschikbaar]']
errors[('license',)] = ['cannot provide an open license when dataset_status is '
'[http://data.overheid.nl/status/niet_beschikbaar]']
return key, data_dict, errors, context
......@@ -53,7 +53,8 @@ def valid_spatial(key, data, errors, context):
return key, data, errors, context
if not ('spatial_scheme',) in data and ('spatial_value',) in data:
errors[('spatial_value',)].append('spatial_value cannot be validated without a corresponding spatial_scheme')
errors[('spatial_value',)].append('spatial_value cannot be validated without a '
'corresponding spatial_scheme')
return key, data, errors, context
if ('spatial_scheme',) in data and not ('spatial_value',) in data:
......@@ -74,7 +75,8 @@ def valid_spatial(key, data, errors, context):
is_valid = True
if not is_valid:
errors[('spatial_value',)].append('value [' + val + '] is not a valid spatial according to the schemes provided')
errors[('spatial_value',)].append('value [' + val + '] is not a valid spatial according'
' to the schemes provided')
return key, data, errors, context
......
......@@ -19,9 +19,9 @@ def is_date(value):
:param value: string, the value to check
:return: string, the original value
"""
import ckanext.dcatdonl.validator.validator_factory as ValidatorFactory
import ckanext.dcatdonl.validator.validator_factory as validator_factory
ValidatorFactory.get_validator('is_string')(value)
validator_factory.get_validator('is_string')(value)
try:
datetime.strptime(value, _DATETIME_FORMAT)
......@@ -41,21 +41,26 @@ def valid_temporal(key, data, errors, context):
:param context: dict, argument to match CKAN method signature, not used
:return: (key, data, errors, context), the original arguments, possibly modified
"""
if not ('temporal_start',) in data or not ('temporal_end',) in data:
return key, data, errors, context
properties = [
('temporal_start',),
('temporal_end',)
]
properties_present = (prop in data for prop in properties)
errors_present = (prop in errors for prop in properties)
error_message = 'temporal_start cannot be greater or equal to temporal_end'
if errors[('temporal_start',)]:
if not any(properties_present):
return key, data, errors, context
if errors[('temporal_end',)]:
if any(errors_present):
return key, data, errors, context
temporal_start = datetime.strptime(data[('temporal_start',)], _DATETIME_FORMAT)
temporal_end = datetime.strptime(data[('temporal_end',)], _DATETIME_FORMAT)
if temporal_start >= temporal_end:
errors[('temporal_start',)].append('temporal_start cannot be greater or equal to temporal_end')
errors[('temporal_end',)].append('temporal_end cannot be smaller or equal to temporal_start')
for prop in properties:
errors[prop].append(error_message)
return key, data, errors, context
......@@ -65,23 +70,23 @@ def date_planned_validation(key, data_dict, errors, context):
Enforces that date_planned becomes mandatory when dataset_status has a value of either '' or ''.
:param key: str, argument to match CKAN method signature, not used
:param data: dict, flattened dict of the dataset
:param data_dict: dict, flattened dict of the dataset
:param errors: dict, flattened dict of the validation errors
:param context: dict, argument to match CKAN method signature, not used
:return: (key, data, errors, context), the original arguments, possibly modified
"""
dataset_status_tuple = ('dataset_status',)
affected_statusses = [
affected_states = [
'http://data.overheid.nl/status/gepland',
'http://data.overheid.nl/status/in onderzoek'
'http://data.overheid.nl/status/in_onderzoek'
]
if not dataset_status_tuple in data_dict:
if dataset_status_tuple not in data_dict:
return key, data_dict, errors, context
if data_dict[dataset_status_tuple] in affected_statusses:
if not ('date_planned') in data_dict:
if data_dict[dataset_status_tuple] in affected_states:
if not ('date_planned',) in data_dict:
errors[('date_planned',)] = ['date_planned is mandatory when dataset_status is gepland '
'or in onderzoek']
'or in_onderzoek']
return key, data_dict, errors, context
......@@ -72,6 +72,7 @@ def convert_to_list_if_string(key, data_dict, errors, context):
return key, data_dict, errors, context
def convert_to_curly_string_if_list(key, data_dict, errors, context):
"""
Converts a list of strings to a string surrounded with curly braces.
......
......@@ -65,7 +65,7 @@ def overheid_license(value):
if isinstance(value, list):
raise tk.Invalid('only one license can be provided, list given')
if not 'id' in value:
if 'id' not in value:
raise tk.Invalid('value must have a id property')
_check_license_file(value['id'])
......@@ -246,7 +246,7 @@ def _check_value(name, value):
valid_values = _read_file_as_json(name)
if not value in valid_values:
if value not in valid_values:
raise tk.Invalid('value [' + value + '] is not a valid ' + name)
return value
......@@ -278,7 +278,7 @@ def _check_values(name, values, minimum=1, maximum=0):
valid_values = _read_file_as_json(name)
for index in values:
if not index in valid_values:
if index not in valid_values:
raise tk.Invalid('value [' + index + '] is not a valid ' + name)
return values
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment