def save(self, domain_override=None, email_template_name='registration/password_reset_email.html',
             use_https=False, token_generator=default_token_generator):
        """
        Generates a one-use only link for resetting password and sends to the user.
        A minimal exception control is implemented to avoid problems with e-mail.
        """
        from expedient.common.utils.mail import send_mail # Wrapper for django.core.mail__send_mail
        for user in self.users_cache:
            if not domain_override:
                current_site = Site.objects.get_current()
                site_name = current_site.name
                domain = current_site.domain
            else:
                site_name = domain = domain_override
            if user.password == '!':
                t = loader.get_template('registration/password_reset_email_ofreg.html')
            else:
                t = loader.get_template(email_template_name)
            c = {
                'email': user.email,
                'domain': domain,
                'site_name': site_name,
                'uid': int_to_base36(user.id),
                'user': user,
                'token': token_generator.make_token(user),
                'protocol': use_https and 'https' or 'http',
            }
            try:
                send_mail(("Password reset for user %s in %s") % (user.username,site_name),
                    t.render(Context(c)), None, [user.email])
            except Exception as e:
                print "[ERROR] Exception at 'expedient.clearinghouse.users.forms': user '%s' (%s) could not fully reset its password. LDAPPasswordResetForm returned: %s" % (user.username, user.email, str(e))
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/users/forms.py/LDAPPasswordResetForm.save/original