diff options
Diffstat (limited to 'src/mailman_pgp/model/list.py')
| -rw-r--r-- | src/mailman_pgp/model/list.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mailman_pgp/model/list.py b/src/mailman_pgp/model/list.py index 0163026..a0101a7 100644 --- a/src/mailman_pgp/model/list.py +++ b/src/mailman_pgp/model/list.py @@ -17,6 +17,7 @@ """Model for PGP enabled mailing lists.""" +from os import remove from os.path import exists, isfile, join from flufl.lock import Lock @@ -99,8 +100,11 @@ class PGPMailingList(Base): def key(self, value): with Lock(self.key_path + '.lock'): self._key = value - with open(self.key_path, 'w') as key_file: - key_file.write(str(value)) + if value is None: + remove(self.key_path) + else: + with open(self.key_path, 'w') as key_file: + key_file.write(str(value)) def generate_key(self, block=False): self._key = None |
