- rename file to fileOrPath

- check for capability, not type, so XMLWriter can hanlde unicode
  filenames (on OS-es that support them).


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@479 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
jvr 2005-01-17 21:34:06 +00:00
parent f34c6f3937
commit 90beb95b77

View File

@ -9,15 +9,15 @@ INDENT = " "
class XMLWriter:
def __init__(self, file, indentwhite=INDENT, idlefunc=None, encoding="ISO-8859-1"):
if type(file) == type(""):
self.file = open(file, "w")
def __init__(self, fileOrPath, indentwhite=INDENT, idlefunc=None, encoding="ISO-8859-1"):
if not hasattr(fileOrPath, "write"):
self.file = open(fileOrPath, "w")
if os.name == "mac":
import macfs
macfs.FSSpec(file).SetCreatorType('R*ch', 'TEXT')
macfs.FSSpec(fileOrPath).SetCreatorType('R*ch', 'TEXT')
else:
# assume writable file object
self.file = file
self.file = fileOrPath
self.indentwhite = indentwhite
self.indentlevel = 0
self.stack = []