Skip to content

Commit

Permalink
Allow only text for the stage plot checklist step
Browse files Browse the repository at this point in the history
Requested via Slack.
  • Loading branch information
kitsuta committed Nov 1, 2024
1 parent 1c2814f commit 5ab9a3f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions uber/site_sections/guests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import shutil

from pockets.autolog import log
import cherrypy
from cherrypy.lib.static import serve_file
from sqlalchemy.orm.exc import NoResultFound
Expand Down Expand Up @@ -117,13 +118,17 @@ def stage_plot(self, session, guest_id, message='', plot=None, **params):
guest = session.guest_group(guest_id)
guest_stage_plot = session.guest_stage_plot(params, restricted=True)
if cherrypy.request.method == 'POST':
guest_stage_plot.filename = plot.filename
guest_stage_plot.content_type = plot.content_type.value
if guest_stage_plot.stage_plot_extension not in c.ALLOWED_STAGE_PLOT_EXTENSIONS:
message = 'Uploaded file type must be one of ' + ', '.join(c.ALLOWED_STAGE_PLOT_EXTENSIONS)
else:
with open(guest_stage_plot.fpath, 'wb') as f:
shutil.copyfileobj(plot.file, f)
if plot.filename:
guest_stage_plot.filename = plot.filename
guest_stage_plot.content_type = plot.content_type.value
if guest_stage_plot.stage_plot_extension not in c.ALLOWED_STAGE_PLOT_EXTENSIONS:
message = 'Uploaded file type must be one of ' + ', '.join(c.ALLOWED_STAGE_PLOT_EXTENSIONS)
else:
with open(guest_stage_plot.fpath, 'wb') as f:
shutil.copyfileobj(plot.file, f)
elif not params.get('notes'):
message = "Please either upload a stage layout or explain your inputs and stage gear needs in the Additional Notes section."
if not message:
guest.stage_plot = guest_stage_plot
session.add(guest_stage_plot)
raise HTTPRedirect('index?id={}&message={}', guest.id, 'Stage directions uploaded')
Expand Down

0 comments on commit 5ab9a3f

Please sign in to comment.