PyYAML: YAMLObject subclasses are ignored
Matthew Wilson <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
I suspect the solution to my problem is something really trivial.
I wrote a module called pitz that contains a class Issue:
>>> pitz.Issue.yaml_tag
u'ditz.rubyforge.org,2008-03-06/issue'
Then I try to load a document with that same tag, but I get a
ConstructorError:
ConstructorError: could not determine a constructor for the tag
'!ditz.rubyforge.org,2008-03-06/issue'
I think there's some namespace/scoping problem, because when I define
the same class in my interpreter and then run yaml.load(issue_file),
everything works OK.
So, how do I tell yaml to build pitz.Issue instances when it runs across
that tag?
Do I need to use add_constructor? If so, I'd *really* appreciate some
example usage.
Thanks!
Matt
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/