Comment 4 for bug 128518

Revision history for this message
Eric Casteleijn (thisfred) wrote :

I think the metadata import was already meant to just log and not error in this case:

                    errors = binding._setData(
                            namespace_key=set.metadata_uri,
                            data={
                                element_name: field.validator.deserializeValue(
                                    field, elements[element_name])},
                            reindex=1)
                    if errors:
                        zLOG.LOG(
                            'Silva', zLOG.WARNING,
                            "Value %s is not allowed for element %s in set %s." % (elements[element_name], element_name, set_id))

but maybe formulator changed, because now an error is thrown. I've changed this (for testing) to:

                    try:
                        errors = binding._setData(
                            namespace_key=set.metadata_uri,
                            data={
                                element_name: field.validator.deserializeValue(
                                    field, elements[element_name])},
                            reindex=1)
                    except ValidationError:
                        zLOG.LOG(
                            'Silva', zLOG.WARNING,
                            "Value %s is not allowed for element %s in set %s." % (elements[element_name], element_name, set_id))
                    if errors:
                        zLOG.LOG(
                            'Silva', zLOG.WARNING,
                            "Value %s is not allowed for element %s in set %s." % (elements[element_name], element_name, set_id))

I'll check it in on the Silva 2.0 branch. Can you test if that fixes the error in your set-up? Then I will try to clean it up a little, and at least write a test for it.