def get_scorm(self, local_id): db_lt = current_user.lt if db_lt.basic_http_authentications: url = db_lt.basic_http_authentications[0].lt_url or '' else: url = '' lt_path = urlparse.urlparse(url).path or '/' extension = '/' if 'gateway4labs/' in lt_path: extension = lt_path[lt_path.rfind('gateway4labs/lms/list') + len('gateway4labs/lms/list'):] lt_path = lt_path[:lt_path.rfind('gateway4labs/')] contents = get_scorm_object(False, local_id, lt_path, extension) return Response(contents, headers = {'Content-Type' : 'application/zip', 'Content-Disposition' : 'attachment; filename=scorm_%s.zip' % local_id})
def get_scorm(self, lt_id, local_id): permission = self.session.query(PermissionToLt).filter_by(lt_id = lt_id, local_identifier = local_id).one() db_lt = permission.lt if db_lt.basic_http_authentications: url = db_lt.basic_http_authentications[0].lt_url or '' else: url = '' lt_path = urlparse.urlparse(url).path or '/' extension = '/' if 'gateway4labs/' in lt_path: extension = lt_path[lt_path.rfind('gateway4labs/lms/list') + len('gateway4labs/lms/list'):] lt_path = lt_path[:lt_path.rfind('gateway4labs/')] contents = get_scorm_object(False, local_id, lt_path, extension) return Response(contents, headers = {'Content-Type' : 'application/zip', 'Content-Disposition' : 'attachment; filename=scorm_%s.zip' % local_id})