datatracker icon indicating copy to clipboard operation
datatracker copied to clipboard

upload_session_slides view is fragile and should be refactored

Open jennifer-richards opened this issue 11 months ago • 0 comments

Describe the issue

The ietf.meeting.views.upload_session_slides() view is fragile and should be refactored. It works by:

  1. Checking whether a Document already exists and either creating one or fetching the existing one and updating (but not saving) its title / rev
  2. Updating SessionPresentation instances to include the doc from step 1
  3. Accepting the uploaded file
  4. Saving the Document from step 1, or returning an error

This means that a failed attempt to save the Document in step 4 leaves inconsistent state in the SessionPresentation instances - they refer to a rev that does not exist. It also might leave behind a Document without contents.

This really should be refactored to create the Document completely, then point at it if all went well.

Code of Conduct

jennifer-richards avatar Mar 07 '24 16:03 jennifer-richards