Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed #12 fixed #13 fixed #14

  • Loading branch information...
commit 780a88592e2ead38a4d99541ecb61d535c905464 1 parent 8b5369b
@taizo authored
View
7 karesansui/lib/checker.py
@@ -74,7 +74,12 @@
CHECK_DICTKEY = 1<<17 # 辞書のキーと一致するかどうか
CHECK_UNIQUE = 1<<18 # 一意であるか
-t = gettext.translation('messages', karesansui.dirname + "/locale")
+try:
+ t = gettext.translation('messages', karesansui.dirname + "/locale")
+except:
+ os.environ['LANG'] = "en_US" # Sets default language.
+ t = gettext.translation('messages', karesansui.dirname + "/locale")
+
_ = t.ugettext
#_ = t.gettext
View
8 karesansui/lib/firewall/iptables.py
@@ -40,11 +40,11 @@
import time
import os, stat
import re
-from StringIO import StringIO
-from xml.dom.ext import PrettyPrint
-from xml.dom.DOMImplementation import implementation
import errno
import pprint
+from StringIO import StringIO
+from xml.dom.minidom import DOMImplementation
+implementation = DOMImplementation()
import karesansui
from karesansui.lib.const import FIREWALL_XML_FILE, \
@@ -75,7 +75,7 @@ def _add_text(self, node, txt):
def generate(self,config):
tree = self.generate_xml_tree(config)
out = StringIO()
- PrettyPrint(tree, out, encoding='UTF-8', indent=' ')
+ out.write(tree.toxml('UTF-8'))
return out.getvalue()
class KaresansuiIpTables(IptablesXMLGenerator):
View
3  karesansui/lib/log/config.py
@@ -37,9 +37,6 @@
"""
import os
-from StringIO import StringIO
-from xml.dom.ext import PrettyPrint
-from xml.dom.DOMImplementation import implementation
import errno
import re
View
8 karesansui/lib/service/config.py
@@ -37,10 +37,10 @@
"""
import os
-from StringIO import StringIO
-from xml.dom.ext import PrettyPrint
-from xml.dom.DOMImplementation import implementation
import errno
+from StringIO import StringIO
+from xml.dom.minidom import DOMImplementation
+implementation = DOMImplementation()
import karesansui
@@ -128,7 +128,7 @@ def _add_text(self, node, txt):
def generate(self, config):
tree = self.generate_xml_tree(config)
out = StringIO()
- PrettyPrint(tree, out)
+ out.write(tree,toxml())
return out.getvalue()
def writecfg(self, cfg):
View
8 karesansui/lib/virt/config.py
@@ -44,10 +44,10 @@
import os, stat
import re
import shutil
-from StringIO import StringIO
-from xml.dom.ext import PrettyPrint
-from xml.dom.DOMImplementation import implementation
import errno
+from StringIO import StringIO
+from xml.dom.minidom import DOMImplementation
+implementation = DOMImplementation()
import karesansui
@@ -596,7 +596,7 @@ def _add_text(self, node, txt):
def generate(self, config):
tree = self.generate_xml_tree(config)
out = StringIO()
- PrettyPrint(tree, out)
+ out.write(tree.toxml())
return out.getvalue()
class ConfigGenerator:
View
2  karesansui/lib/virt/config_capabilities.py
@@ -101,8 +101,6 @@
import time
from StringIO import StringIO
-from xml.dom.ext import PrettyPrint
-from xml.dom.DOMImplementation import implementation
import errno
import karesansui
View
8 karesansui/lib/virt/config_export.py
@@ -39,10 +39,10 @@
import os
import time
-from StringIO import StringIO
-from xml.dom.ext import PrettyPrint
-from xml.dom.DOMImplementation import implementation
import errno
+from StringIO import StringIO
+from xml.dom.minidom import DOMImplementation
+implementation = DOMImplementation()
import karesansui
@@ -234,7 +234,7 @@ def _add_text(self, node, txt):
def generate(self, config):
tree = self.generate_xml_tree(config)
out = StringIO()
- PrettyPrint(tree, out)
+ out.write(tree.toxml())
return out.getvalue()
def writecfg(self, cfg):
View
8 karesansui/lib/virt/config_network.py
@@ -43,10 +43,10 @@
import time
import os, stat
import re
-from StringIO import StringIO
-from xml.dom.ext import PrettyPrint
-from xml.dom.DOMImplementation import implementation
import errno
+from StringIO import StringIO
+from xml.dom.minidom import DOMImplementation
+implementation = DOMImplementation()
import karesansui
from karesansui.lib.const import KARESANSUI_GROUP, \
@@ -247,7 +247,7 @@ def _add_text(self, node, txt):
def generate(self, config):
tree = self.generate_xml_tree(config)
out = StringIO()
- PrettyPrint(tree, out)
+ out.write(tree.toxml())
return out.getvalue()
class NetworkXMLConfigGenerator(NetworkXMLGenerator):
View
8 karesansui/lib/virt/config_storage.py
@@ -40,10 +40,10 @@
import time
import os, stat
import re
-from StringIO import StringIO
-from xml.dom.ext import PrettyPrint
-from xml.dom.DOMImplementation import implementation
import errno
+from StringIO import StringIO
+from xml.dom.minidom import DOMImplementation
+implementation = DOMImplementation()
import karesansui
from karesansui.lib.const import KARESANSUI_GROUP, \
@@ -478,7 +478,7 @@ def _add_text(self, node, txt):
def generate(self, config):
tree = self.generate_xml_tree(config)
out = StringIO()
- PrettyPrint(tree, out)
+ out.write(tree.toxml())
return out.getvalue()
def end_build(self):
View
6 karesansui/lib/virt/snapshot.py
@@ -48,8 +48,8 @@
import glob
from StringIO import StringIO
-from xml.dom.ext import PrettyPrint
-from xml.dom.DOMImplementation import implementation
+from xml.dom.minidom import DOMImplementation
+implementation = DOMImplementation()
import karesansui
import karesansui.lib.locale
@@ -109,7 +109,7 @@ def reset_error_msg(self):
def generateXML(self, doc):
out = StringIO()
- PrettyPrint(doc, out)
+ out.write(doc,toxml())
return out.getvalue()
def isSupportedDomain(self,domain=None):
Please sign in to comment.
Something went wrong with that request. Please try again.