learning-unlimited / ESP-Website

A website to help manage the logistics of large, short-term educational programs
82 stars 57 forks source link

regProf isn't set in specific cases for profile form #3626

Closed willgearty closed 1 year ago

willgearty commented 1 year ago

It looks like there are two cases where the regProf variable isn't set in profile_editor:

  1. https://github.com/learning-unlimited/ESP-Website/blob/1564f16d214c1293095e17eb515eaf6027e6ad32/esp/esp/web/views/myesp.py#L205-L208
  2. https://github.com/learning-unlimited/ESP-Website/blob/1564f16d214c1293095e17eb515eaf6027e6ad32/esp/esp/web/views/myesp.py#L210

This is an issue because we then call regProf to identify if a user is new or not later in profile_editor (https://github.com/learning-unlimited/ESP-Website/pull/3494): https://github.com/learning-unlimited/ESP-Website/blob/1564f16d214c1293095e17eb515eaf6027e6ad32/esp/esp/web/views/myesp.py#L255

I suppose we could either change line 255 and not call regProf (instead, we could set new user within the above if/elses) or update the above two cases to set regProf.

Reported by Princeton (via @hwatheod)

hwatheod commented 1 year ago

I don't think there's a problem in case number 1. The pass just indicates an empty except clause; it doesn't break out of the underlying else clause.

willgearty commented 1 year ago

Ah, you are right, thanks @hwatheod!