def _validate_dynamicschema(self, schema, field, dct):
        """Validate the dictionary `dct` against a schema dynamically read from
        another document of (potentially) another resource.

        A `dynamicschema` has the following fields:

        * ``resource``: resource to load the schema from
        * ``field``: the field name to use in querying the resource (its value
          is taken as the same field in the current document)
        * ``schema``: the field in the retrieved document holding the schema
        * ``transform``: a function to transform the schema (optional)"""
        query = {schema['field']: self.document[schema['field']]}
        res = app.data.find_one(schema['resource'], None, **query)
        if res:
            dynamic_schema = res[schema['schema']]
            if 'transform' in schema:
                dynamic_schema = schema['transform'](dynamic_schema)
            self._validate_schema(dynamic_schema, field, dct, None)
        else:
            self._error(field, "Could not find any %s for query %s" %
                        (schema['resource'], query))
dataset/ETHPy150Open taarifa/TaarifaAPI/taarifa_api/taarifa_api.py/KeySchemaValidator._validate_dynamicschema/original