summaryrefslogtreecommitdiffstats
path: root/cobbler/serializer.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2006-05-05 16:32:16 -0400
committerJim Meyering <jim@meyering.net>2006-05-05 16:32:16 -0400
commit297525dcb3c500d086bb4a5006a5839d98f8522b (patch)
tree9b2fc55d3c63df1e9c0928105c5b848882f52c95 /cobbler/serializer.py
parent036eb874ffbaf70236427ebe7c10fb883706e291 (diff)
downloadthird_party-cobbler-297525dcb3c500d086bb4a5006a5839d98f8522b.tar.gz
third_party-cobbler-297525dcb3c500d086bb4a5006a5839d98f8522b.tar.xz
third_party-cobbler-297525dcb3c500d086bb4a5006a5839d98f8522b.zip
Interim refactoring commit
Diffstat (limited to 'cobbler/serializer.py')
-rw-r--r--cobbler/serializer.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/cobbler/serializer.py b/cobbler/serializer.py
new file mode 100644
index 0000000..847be6e
--- /dev/null
+++ b/cobbler/serializer.py
@@ -0,0 +1,19 @@
+# Michael DeHaan <mdehaan@redhat.com>
+
+import api
+import util
+
+def serialize(obj):
+ fd = open(obj.filename(),"w+")
+ datastruct = obj.to_datastruct()
+ yaml = syck.dump(datastruct)
+ fd.write(yaml)
+ fd.close()
+ return True
+
+def deserialize(obj):
+ fd = open(obj.filename(),"r")
+ data = fd.read()
+ datastruct = yaml.load(data)
+ fd.close()
+ return obj.from_datastruct(datastruct)