Hi,
It seems that the user defined directives are ignore when just after the merge key.
I have the following yml code
Chip:
Name: "CHIPNAME"
RegSize: 4
<< : !include
file_name: ymlInclude2.yml
Where include is my own directive which just reads in a file
class Include(yaml.YAMLObject):
yaml_tag = '!include'
@classmethod
def from_yaml(cls, constructor, node):
# Convert the node to a dictionary
attributes = constructor.construct_mapping(node)
# Convert spaces into underlines
if attributes.has_key('file_name'):
common.log.info("We are reading in file: " + attributes['file_name'])
db = loadYAMLFile(attributes['file_name'])
# print db
return db
else:
raise KeyError, "!Include directive must have an attribute file_name"
@classmethod
def to_yaml(cls, representer, person):
pass # we havent implemented this
# Create mapping node
def __init__(self, file_name=None):
self.file_name = file_name
But the directive doesnt get called when I use the merge key.
What I get when I run is this python structure.
{'Chip':
{'file_name': 'ymlInclude2.yml',
'Name': 'CHIPNAME', 'RegSize': 4},
'FormatVersion': 1}
So it seems that the directives are ignore when using the merge key.