This commit is contained in:
Jeremy Fincher 2004-10-24 06:32:07 +00:00
parent c374b82b28
commit 447a6e63e0

View File

@ -78,11 +78,12 @@ def open(filename, clear=False):
acc += line[:-1] acc += line[:-1]
continue continue
else: else:
acc = line acc += line
try: try:
(key, value) = re.split(r'(?<!\\):', acc, 1) (key, value) = re.split(r'(?<!\\):', acc, 1)
key = key.strip() key = key.strip()
value = value.strip() value = value.strip()
acc = ''
except ValueError: except ValueError:
raise InvalidRegistryFile, 'Error unpacking line %r' % acc raise InvalidRegistryFile, 'Error unpacking line %r' % acc
_cache[key] = value _cache[key] = value
@ -122,7 +123,6 @@ def close(registry, filename, private=True):
fd.write('%s: %s\n' % (name, s)) fd.write('%s: %s\n' % (name, s))
except Exception, e: except Exception, e:
exception('Exception printing value:') exception('Exception printing value:')
fd.close() fd.close()
def isValidRegistryName(name): def isValidRegistryName(name):
@ -483,13 +483,15 @@ class NormalizedString(String):
s = str(self) s = str(self)
prefixLen = len(self._name) + 2 prefixLen = len(self._name) + 2
lines = textwrap.wrap(s, width=76-prefixLen) lines = textwrap.wrap(s, width=76-prefixLen)
first = True last = len(lines)-1
for (i, line) in enumerate(lines): for (i, line) in enumerate(lines):
if not first: if i != 0:
line = ' '*prefixLen + line line = ' '*prefixLen + line
lines[i] = line + '\\' if i != last:
first = False line += '\\'
return os.linesep.join(lines) lines[i] = line
ret = os.linesep.join(lines)
return ret
class StringSurroundedBySpaces(String): class StringSurroundedBySpaces(String):
def setValue(self, v): def setValue(self, v):