handle pubkey post save more gracefully
parent
e150e07001
commit
33fee98309
|
@ -165,7 +165,17 @@ class Pubkey(Model):
|
||||||
|
|
||||||
@receiver(post_save, sender=Pubkey)
|
@receiver(post_save, sender=Pubkey)
|
||||||
def on_pubkey_post_save(sender, instance, **kwargs):
|
def on_pubkey_post_save(sender, instance, **kwargs):
|
||||||
instance.townie.write_authorized_keys()
|
# Ensure we're checking the townie as it exists at the point of pubkey
|
||||||
|
# save. If a user is being reviewed, we'll write their key file in the
|
||||||
|
# townie pre save.
|
||||||
|
townie = Townie.objects.filter(username=instance.townie.username)
|
||||||
|
if not townie:
|
||||||
|
return
|
||||||
|
|
||||||
|
townie = townie[0]
|
||||||
|
|
||||||
|
if townie.reviewed:
|
||||||
|
townie.write_authorized_keys()
|
||||||
|
|
||||||
|
|
||||||
@receiver(pre_save, sender=Townie)
|
@receiver(pre_save, sender=Townie)
|
||||||
|
|
Loading…
Reference in New Issue