Browse Source

Restrict redirection call to presentation edit only.

develop
Sam Black 4 years ago
parent
commit
09eeb153a5
Signed by: samwwwblack GPG Key ID: 0FF0223994EA47D8
1 changed files with 15 additions and 15 deletions
  1. +15
    -15
      vowel/utils/presentation.py

+ 15
- 15
vowel/utils/presentation.py View File

@ -179,17 +179,6 @@ class ConverterBase(object):
namespace=PRESENTATION_CONVERT_NAMESPACE,
room=self.socketio_session)
def sio_redirect(self, url):
"""
Send a redirect message via socketio.
:param url: URL to redirect to
:type url: str
"""
self.socketio.emit("redirect", url,
namespace=PRESENTATION_CONVERT_NAMESPACE,
room=self.socketio_session)
def presentation_create(self, filename, slide_content, linked_resources):
"""
Create new presentation resource database entries.
@ -261,6 +250,18 @@ class ConverterBase(object):
return new_resource.id
def redirect(self, presentation_id):
"""
Send a redirect command to the browser via socketio.
:param presentation_id: presentation to redirect to
:type presentation_id: int
"""
url = url_for("presentations.edit", presentation_id=presentation_id)
self.socketio.emit("redirect", url,
namespace=PRESENTATION_CONVERT_NAMESPACE,
room=self.socketio_session)
def convert(self):
"""
Run the conversion.
@ -442,8 +443,7 @@ class PPTConverter(ConverterBase):
self.sio_message("Conversion completed")
self.sio_percentage(100)
self.sio_redirect(url_for("presentations.edit",
presentation_id=presentation_id))
self.redirect(presentation_id)
class PDFConverter(ConverterBase):
@ -541,8 +541,8 @@ class PDFConverter(ConverterBase):
self.sio_message("Conversion completed")
self.sio_percentage(100)
self.sio_redirect(url_for("presentations.edit",
presentation_id=presentation_id))
self.redirect(presentation_id)
@rq_manager.job("high")


Loading…
Cancel
Save