| Index: localeTools.py |
| =================================================================== |
| --- a/localeTools.py |
| +++ b/localeTools.py |
| @@ -196,37 +196,16 @@ def readFile(path): |
| def generateStringEntry(key, value, path): |
| if path.endswith('.dtd'): |
| return '<!ENTITY %s "%s">\n' % (escapeEntity(key), escapeEntity(value)) |
| else: |
| return '%s=%s\n' % (escapeProperty(key), escapeProperty(value)) |
| -def appendToFile(path, key, value): |
| - fileHandle = codecs.open(path, 'ab', encoding='utf-8') |
| - fileHandle.write(generateStringEntry(key, value, path)) |
| - fileHandle.close() |
| - |
| - |
| -def removeFromFile(path, key): |
| - fileHandle = codecs.open(path, 'rb', encoding='utf-8') |
| - data = fileHandle.read() |
| - fileHandle.close() |
| - |
| - if path.endswith('.dtd'): |
| - data = re.sub(r'<!ENTITY\s+%s\s+"[^"]*">\s*' % key, '', data, re.S) |
| - else: |
| - data = re.sub(r'(^|\n)%s=[^\n]*\n' % key, r'\1', data, re.S) |
| - |
| - fileHandle = codecs.open(path, 'wb', encoding='utf-8') |
| - fileHandle.write(data) |
| - fileHandle.close() |
| - |
| - |
| def toJSON(path): |
| fileHandle = codecs.open(path, 'rb', encoding='utf-8') |
| data = fileHandle.read() |
| fileHandle.close() |
| if path.endswith('.dtd'): |
| it = parseDTDString(data, path) |
| elif path.endswith('.properties'): |