'A signal handler to be called after saving a user.
Invalidates the cache for the given user\'s gravatar URL.'

def on_user_save(self, sender, instance, created, **kwargs):

    job = UserGravatarURLJob()
    if instance.email:
        handler = job.invalidate
    elif (instance.email is None):
        handler = job.delete
    else:
        return
    for size in settings.AVATAR_SIZES:
        handler(instance.email, size=size)
