The new metadata should be loaded into a temporary variable to ensure it is still valid. For example I added a space in an XML attribute name and it saved ok but then the SP was unusable.
e.g.
test = lasso.Server()
test.addProviderFromBuffer(lasso.PROVIDER_ROLE_SP, metabuf)
(and then probably some validation that something has loaded or a try/except around it).
Commit has been amended to include a validation check. Previously other places where metadata was being loaded did not validate the metadata, this has also been corrected.
Note, the validation function is weak, it does call addProviderFromBuffer and check for errors but that Lasso function only weakly validates the metadata, basically all it does is parse the XML. At some point we might want better metadata validation but at least now it's localized in one place and called everywhere so improving the validation should be straight forward.
ACK. The validation is about the best we can do for now.
This has been merged, thanks.