A few more little fix-ups and initial thoughts on what I'm trying to achieve. It's still a little confused around the TranslationLayerRequirements.

This commit is contained in:
Mike Auty
2015-12-01 00:00:14 +00:00
parent 58582715db
commit 0e75503645
2 changed files with 31 additions and 0 deletions
+15
View File
@@ -69,3 +69,18 @@ class ListRequirement(ConfigurationSchemaNode):
if not (self.min_elements <= len(value) <= self.max_elements):
raise TypeError("List option provided more or less elements than allowed.")
[self.element_type.validate(element, context) for element in value]
# class DisjunctionRequirement(ConfigurationSchemaNode):
# """Class allow any of multiple requirements"""
#
# def __init__(self, requirements, *args, **kwargs):
#
#
# # TODO: Type check requirements to ensure it's a dictionary of requirements
#
#
# class ConjunctionRequierment(ConfigurationSchemaNode):
# """Class require all of multiple requirements"""
#
# def __init__(self, requirements, *args, **kwargs):
# # TODO: Type check requirements to ensure it's a dictionary of requirements
@@ -7,6 +7,22 @@ __author__ = 'mike'
SCHEMA_NAME_DIVIDER = "."
# Design requirements:
# Plugins can be queried for their requirements without instantiating them
# The context can record validated data
# Configurables can have multiple identical (but differently named) requirement trees (based off the same schema)
# Instantiated plugins can pre-populate the context with (validated) da (in order to force layer names)
# Translation layer requirements can specify a layer name (or generate one if not specified)
# Still not decided whether the layer holds the name chosen (and this can be pre-populated) or if it's specified
# as part of the requirement, which then returns true/false if it could be fulfilled
# Non-instantiated plugin
# -> Requirement schema nodes (instantiated)
# (Translation layers contain all information required)
# Instantiate plugin
# -> Requirement schema nodes (instantiated) wrapped in value reader/writer/valdiator
def schema_name_join(pathlist):
return SCHEMA_NAME_DIVIDER.join(pathlist)