summaryrefslogtreecommitdiffstats
path: root/cobbler/serializer.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-05-29 18:48:39 -0400
committerMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-05-29 18:48:39 -0400
commitf0d5545df35f9974fb8c4ae572cfea831e79a358 (patch)
tree7876991786aac9479faa894c4d0f7dcb2a9cdcea /cobbler/serializer.py
parent201e727a1fc571f3a56763dc044a58504cc89af6 (diff)
downloadthird_party-cobbler-f0d5545df35f9974fb8c4ae572cfea831e79a358.tar.gz
third_party-cobbler-f0d5545df35f9974fb8c4ae572cfea831e79a358.tar.xz
third_party-cobbler-f0d5545df35f9974fb8c4ae572cfea831e79a358.zip
Begining of i18n of cobbler. Tests pass, works with English. Need to test
translation function and run manual testing to ensure no functional errors in other places (such as import). cobbler_msg (strings file) has been removed.
Diffstat (limited to 'cobbler/serializer.py')
-rw-r--r--cobbler/serializer.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/cobbler/serializer.py b/cobbler/serializer.py
index b74d6aa..a8a3e73 100644
--- a/cobbler/serializer.py
+++ b/cobbler/serializer.py
@@ -16,7 +16,7 @@ import yaml # Howell-Clark version
import errno
import os
-import cexceptions
+from cexceptions import *
import utils
from rhpl.translate import _, N_, textdomain, utf8
@@ -38,11 +38,11 @@ def serialize(obj):
os.makedirs(dirname)
# evidentally this doesn't throw exceptions.
except OSError, ose:
- raise cexceptions.CobblerException("need_perms", os.path.dirname(dirname))
+ raise CX(_("Need permissions to write to %s") % os.path.dirname(dirname))
try:
fd = open(filename,"w+")
except IOError, ioe3:
- raise cexceptions.CobblerException("need_perms", filename)
+ raise CX(_("Need permissions to write to %s") % filename)
return False
datastruct = obj.to_datastruct()
encoded = yaml.dump(datastruct)
@@ -66,12 +66,9 @@ def deserialize(obj):
if not os.path.exists(filename):
return True
else:
- raise cexceptions.CobblerException("need_perms",obj.filename())
+ raise CX(_("Need permissions to read %s") % obj.filename())
data = fd.read()
datastruct = yaml.load(data).next() # first record
- # leftover from PySyck choke detection. Not relevant?
- # if type(datastruct) == str:
- # raise CobblerException("parse_error",filename)
fd.close()
obj.from_datastruct(datastruct)
return True