totally revert the whole 21728/21729 open=>io.open changes
svn: r21734
This commit is contained in:
parent
c34610e60d
commit
bd1020314e
@ -35,7 +35,6 @@ General option handling, including saving and parsing.
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import io
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -199,7 +198,7 @@ class OptionListCollection(object):
|
||||
"""
|
||||
Saves the current OptionListCollection to the associated file.
|
||||
"""
|
||||
f = io.open(self.filename, "w", encoding='utf-8')
|
||||
f = open(self.filename,"w")
|
||||
f.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
f.write('<options>\n')
|
||||
|
||||
|
@ -1083,7 +1083,7 @@ class PluginRegister(object):
|
||||
full_filename = os.path.join(dir, filename)
|
||||
if sys.version_info[0] < 3:
|
||||
full_filename = full_filename.encode(glocale.getfilesystemencoding())
|
||||
fd = open(full_filename, 'r')
|
||||
fd = open(full_filename, "r")
|
||||
else:
|
||||
fd = io.open(full_filename, 'r', encoding = 'utf-8')
|
||||
stream = fd.read()
|
||||
|
@ -31,7 +31,6 @@
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
from xml.sax.saxutils import escape
|
||||
import io
|
||||
|
||||
def escxml(string):
|
||||
"""
|
||||
@ -149,7 +148,7 @@ class StyleSheetList(object):
|
||||
"""
|
||||
Saves the current StyleSheet definitions to the associated file.
|
||||
"""
|
||||
xml_file = io.open(self.__file, "w", encoding='utf-8')
|
||||
xml_file = open(self.__file, "w")
|
||||
xml_file.write("<?xml version=\"1.0\"?>\n")
|
||||
xml_file.write('<stylelist>\n')
|
||||
|
||||
@ -212,7 +211,7 @@ class StyleSheetList(object):
|
||||
if os.path.isfile(self.__file):
|
||||
parser = make_parser()
|
||||
parser.setContentHandler(SheetParser(self))
|
||||
the_file = io.open(self.__file, encoding='utf-8')
|
||||
the_file = open(self.__file)
|
||||
parser.parse(the_file)
|
||||
the_file.close()
|
||||
except (IOError, OSError, SAXParseException):
|
||||
|
@ -31,8 +31,6 @@
|
||||
# Standard Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import io
|
||||
from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.get_translation().gettext
|
||||
|
||||
@ -43,6 +41,7 @@ _ = glocale.get_translation().gettext
|
||||
#------------------------------------------------------------------------
|
||||
import logging
|
||||
log = logging.getLogger(".Book")
|
||||
import os
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -319,7 +318,7 @@ class BookList(object):
|
||||
"""
|
||||
Saves the current BookList to the associated file.
|
||||
"""
|
||||
f = io.open(self.file, "w", encoding='utf-8')
|
||||
f = open(self.file, "w")
|
||||
f.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
f.write('<booklist>\n')
|
||||
for name in sorted(self.bookmap): # enable a diff of archived copies
|
||||
@ -371,7 +370,7 @@ class BookList(object):
|
||||
try:
|
||||
p = make_parser()
|
||||
p.setContentHandler(BookParser(self, self.dbase))
|
||||
the_file = io.open(self.file, encoding='utf-8')
|
||||
the_file = open(self.file)
|
||||
p.parse(the_file)
|
||||
the_file.close()
|
||||
except (IOError, OSError, ValueError, SAXParseException, KeyError,
|
||||
|
@ -36,7 +36,6 @@ Report option handling, including saving and parsing.
|
||||
import os
|
||||
import copy
|
||||
from xml.sax.saxutils import escape
|
||||
import io
|
||||
|
||||
def escxml(d):
|
||||
return escape(d, { '"' : '"' } )
|
||||
@ -476,7 +475,7 @@ class OptionListCollection(_options.OptionListCollection):
|
||||
if os.path.isfile(self.filename):
|
||||
p = make_parser()
|
||||
p.setContentHandler(OptionParser(self))
|
||||
the_file = io.open(self.filename, encoding = 'utf-8')
|
||||
the_file = open(self.filename)
|
||||
p.parse(the_file)
|
||||
the_file.close()
|
||||
except (IOError, OSError, SAXParseException):
|
||||
@ -966,7 +965,7 @@ class DocOptionListCollection(_options.OptionListCollection):
|
||||
if os.path.isfile(self.filename):
|
||||
p = make_parser()
|
||||
p.setContentHandler(DocOptionParser(self))
|
||||
the_file = io.open(self.filename, encoding = 'utf-8')
|
||||
the_file = open(self.filename)
|
||||
p.parse(the_file)
|
||||
the_file.close()
|
||||
except (IOError, OSError, SAXParseException):
|
||||
|
Loading…
Reference in New Issue
Block a user