From: Brian Dolbec Date: Sat, 22 Jun 2013 01:43:33 +0000 (-0700) Subject: Add a configured separator for the in file seed info. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6f3b196fe61f1cd20b23e5a08a9a9f238e2f5c4d;p=gentoo-keys.git Add a configured separator for the in file seed info. --- diff --git a/gkeys/seed.py b/gkeys/seed.py index d045a22..4b4710a 100644 --- a/gkeys/seed.py +++ b/gkeys/seed.py @@ -23,6 +23,8 @@ from gkeys.config import GKEY class Seeds(object): '''Handles all seed key file operations''' + separator = '|' + def __init__(self, filepath=None): '''Seeds class init function @@ -69,7 +71,7 @@ class Seeds(object): logger.debug("Begin saving seed file %s" % self.filename) try: with open(self.filename, 'w') as seedfile: - seedlines = [x.value_string() for x in self.seeds] + seedlines = [x.value_string(self.separator) for x in self.seeds] seedfile.write('\n'.join(seedlines)) seedfile.write("\n") except IOError as err: @@ -147,7 +149,7 @@ class Seeds(object): def _split_seed(seed): '''Splits the seed string and replaces all occurances of 'None' with the python type None''' - iterable = seed.split() + iterable = seed.split(self.separator) for i in range(len(iterable)): if iterable[i] == 'None': iterable[i] = None