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