Opened 5 years ago

Closed 5 years ago

#30977 closed Cleanup/optimization (fixed)

Moved site variables assignment outside of the loop in PasswordResetForm.save().

Reported by: Hasan Ramezani Owned by: Hasan Ramezani
Component: contrib.auth Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

There is a code block for assigning the site variables in contrib.auth.forms.PasswordResetForm.save()

       for user in self.get_users(email):
            if not domain_override:
                current_site = get_current_site(request)
                site_name = current_site.name
                domain = current_site.domain
            else:
                site_name = domain = domain_override

It would be better to move this block outside because of user is not used in this block.

Change History (4)

comment:1 by Hasan Ramezani, 5 years ago

Owner: changed from nobody to Hasan Ramezani
Status: newassigned

comment:2 by Hasan Ramezani, 5 years ago

Component: Uncategorizedcontrib.auth
Type: UncategorizedCleanup/optimization
Version: 2.2master

comment:3 by Mariusz Felisiak, 5 years ago

Summary: Moved site variables assignment outside of the loop in contrib.auth.forms.PasswordResetForm.save()Moved site variables assignment outside of the loop in PasswordResetForm.save().
Triage Stage: UnreviewedAccepted

comment:4 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In 4cec3cc:

Fixed #30977 -- Optimized PasswordResetForm.save() a bit.

Moved site variables assignment outside of the loop.

Note: See TracTickets for help on using tickets.
Back to Top