How do I use python YAMLObject to_yaml and from_yaml?
Matthew Wilson <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
I've got a subclass of yaml.YAMLObject named Scratch and I want any instance of Scratch to be able to render itself as yaml. I figured I could just call from_yaml, but this is a classmethod! Why should to_yaml be a classmethod? I want to output yaml based on the variables on the instance. For Scratch.from_yaml, I can't figure out how to feed it the right stuff to get it to take in a string of yaml and make an instance of Scratch. I know I can use yaml.dump and yaml.load, but I want these to be methods on my class. I'm sure there's very smart reasons for this design, but I need some help understanding how to use it. Matt -- Matthew Wilson [email protected] http://tplus1.com ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com