Ticket #209 (new enhancement)
YAMLObject to work with any loader
|Reported by:||poke||Owned by:||xi|
I’m using SafeLoader with all my PyYAML load commands. However to be able to use custom YAMLObjects, I am required to set the custom object’s yaml_loader property to that loader as well to make it discoverable. This should work differently, so a single YAMLObject subtype is not bound to a single Loader type.
For example when loading using this line:
yaml.load( stream, Loader=yaml.SafeLoader )
I am required to define a YAMLObject like this:
class YamlTest ( YAMLObject ): yaml_tag = '!Test' yaml_loader = yaml.SafeLoader
The metaclass should store the constructor and representer references somewhere outside of the Loader and Dumper class objects so defined types work universally.