Skip to content

Commit

Permalink
Moving super().save()
Browse files Browse the repository at this point in the history
Moved `super().save()` to after setting self.address
  • Loading branch information
Tobi committed Oct 10, 2016
1 parent cc65322 commit dbaf39c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions email_extras/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ def __str__(self):
return self.addresses

def save(self, *args, **kwargs):
super(Key, self).save(*args, **kwargs)
gpg = GPG(gnupghome=GNUPG_HOME)
result = gpg.import_keys(self.key)
addresses = []
for key in result.results:
addresses.extend(addresses_for_key(gpg, key))
self.addresses = ",".join(addresses)
self.save(update_fields=['addresses'])
super(Key, self).save(*args, **kwargs)
for address in addresses:
address, _ = Address.objects.get_or_create(address=address)
address.use_asc = self.use_asc
Expand Down

0 comments on commit dbaf39c

Please sign in to comment.