def render(self): download_url = munge_url_for_localdev(self.metadata.download_url) escaped_name = escape_url_for_template( '{}{}'.format(self.metadata.name, self.metadata.ext) ) logger.debug('extension::{} supported-list::{}'.format(self.metadata.ext, settings.EXPORT_SUPPORTED)) if self.metadata.ext.lower() not in settings.EXPORT_SUPPORTED: logger.debug('Extension not found in supported list!') return self.TEMPLATE.render( base=self.assets_url, url=escape_url_for_template(download_url.geturl()), stable_id=self.metadata.stable_id, file_name=escaped_name, enable_hypothesis=settings.ENABLE_HYPOTHESIS, ) logger.debug('Extension found in supported list!') exported_url = furl.furl(self.export_url) if settings.EXPORT_MAXIMUM_SIZE: exported_url.args['format'] = '{}.{}'.format(settings.EXPORT_MAXIMUM_SIZE, settings.EXPORT_TYPE) else: exported_url.args['format'] = settings.EXPORT_TYPE self.metrics.add('needs_export', True) return self.TEMPLATE.render( base=self.assets_url, url=escape_url_for_template(exported_url.url), stable_id=self.metadata.stable_id, file_name=escaped_name, enable_hypothesis=settings.ENABLE_HYPOTHESIS, )
def render(self): download_url = munge_url_for_localdev(self.metadata.download_url) escaped_name = escape_url_for_template('{}{}'.format( self.metadata.name, self.metadata.ext)) logger.debug('extension::{} supported-list::{}'.format( self.metadata.ext, settings.EXPORT_SUPPORTED)) if self.metadata.ext.lower() not in settings.EXPORT_SUPPORTED: logger.debug('Extension not found in supported list!') return self.TEMPLATE.render( ga_tracking_id=GOOGLE_ANALYTICS_TRACKING_ID, base=self.assets_url, url=escape_url_for_template(download_url.geturl()), stable_id=self.metadata.stable_id, file_name=escaped_name, enable_hypothesis=settings.ENABLE_HYPOTHESIS, ) logger.debug('Extension found in supported list!') exported_url = furl.furl(self.export_url) if settings.EXPORT_MAXIMUM_SIZE: exported_url.args['format'] = '{}.{}'.format( settings.EXPORT_MAXIMUM_SIZE, settings.EXPORT_TYPE) else: exported_url.args['format'] = settings.EXPORT_TYPE self.metrics.add('needs_export', True) return self.TEMPLATE.render( ga_tracking_id=GOOGLE_ANALYTICS_TRACKING_ID, base=self.assets_url, url=escape_url_for_template(exported_url.url), stable_id=self.metadata.stable_id, file_name=escaped_name, enable_hypothesis=settings.ENABLE_HYPOTHESIS, )
def render(self): download_url = munge_url_for_localdev(self.metadata.download_url) return self.TEMPLATE.render( base=self.assets_url, url=download_url.geturl(), options=json.dumps(settings.OPTIONS), )
def render(self): download_url = munge_url_for_localdev(self.metadata.download_url) safe_url = escape_url_for_template(download_url.geturl()) return self.TEMPLATE.render( base=self.assets_url, url=safe_url, options=json.dumps(settings.OPTIONS), )
def render(self): self.metrics.add('needs_export', False) if self.metadata.ext in settings.EXPORT_EXCLUSIONS: download_url = munge_url_for_localdev(self.url) safe_url = escape_url_for_template(download_url.geturl()) return self.TEMPLATE.render(base=self.assets_url, url=safe_url) exported_url = furl.furl(self.export_url) if settings.EXPORT_MAXIMUM_SIZE and settings.EXPORT_TYPE: exported_url.args['format'] = '{}.{}'.format(settings.EXPORT_MAXIMUM_SIZE, settings.EXPORT_TYPE) elif settings.EXPORT_TYPE: exported_url.args['format'] = settings.EXPORT_TYPE else: download_url = munge_url_for_localdev(self.url) safe_url = escape_url_for_template(download_url.geturl()) return self.TEMPLATE.render(base=self.assets_url, url=safe_url) self.metrics.add('needs_export', True) safe_url = escape_url_for_template(exported_url.url) return self.TEMPLATE.render(base=self.assets_url, url=safe_url)
def render(self): self.metrics.add('needs_export', False) if self.metadata.ext in settings.EXPORT_EXCLUSIONS: download_url = munge_url_for_localdev(self.url) return self.TEMPLATE.render(base=self.assets_url, url=download_url.geturl()) exported_url = furl.furl(self.export_url) if settings.EXPORT_MAXIMUM_SIZE and settings.EXPORT_TYPE: exported_url.args['format'] = '{}.{}'.format( settings.EXPORT_MAXIMUM_SIZE, settings.EXPORT_TYPE) elif settings.EXPORT_TYPE: exported_url.args['format'] = settings.EXPORT_TYPE else: download_url = munge_url_for_localdev(self.url) return self.TEMPLATE.render(base=self.assets_url, url=download_url.geturl()) self.metrics.add('needs_export', True) return self.TEMPLATE.render(base=self.assets_url, url=exported_url.url)
def render(self): self.metrics.add('needs_export', False) if self.metadata.ext in settings.EXPORT_EXCLUSIONS: download_url = munge_url_for_localdev(self.metadata.download_url) return self.TEMPLATE.render( base=self.assets_url, url=download_url.geturl(), ext=self.metadata.ext.lower(), ) exported_url = furl.furl(self.export_url) exported_url.args['format'] = settings.EXPORT_TYPE self.metrics.add('needs_export', True) return self.TEMPLATE.render( base=self.assets_url, url=exported_url.url, ext=settings.EXPORT_TYPE, )
def render(self): self.metrics.add('needs_export', False) if self.metadata.ext in settings.EXPORT_EXCLUSIONS: download_url = munge_url_for_localdev(self.metadata.download_url) safe_url = escape_url_for_template(download_url.geturl()) return self.TEMPLATE.render( base=self.assets_url, url=safe_url, ext=self.metadata.ext.lower(), ) exported_url = furl.furl(self.export_url) exported_url.args['format'] = settings.EXPORT_TYPE self.metrics.add('needs_export', True) safe_url = escape_url_for_template(exported_url.url) return self.TEMPLATE.render( base=self.assets_url, url=safe_url, ext=settings.EXPORT_TYPE, )
def render(self): download_url = munge_url_for_localdev(self.metadata.download_url) logger.debug('extension::{} supported-list::{}'.format( self.metadata.ext, settings.EXPORT_SUPPORTED)) if self.metadata.ext not in settings.EXPORT_SUPPORTED: logger.debug('Extension not found in supported list!') return self.TEMPLATE.render(base=self.assets_url, url=download_url.geturl()) logger.debug('Extension found in supported list!') exported_url = furl.furl(self.export_url) if settings.EXPORT_TYPE: if settings.EXPORT_MAXIMUM_SIZE: exported_url.args['format'] = '{}.{}'.format( settings.EXPORT_MAXIMUM_SIZE, settings.EXPORT_TYPE) else: exported_url.args['format'] = settings.EXPORT_TYPE self.metrics.add('needs_export', True) return self.TEMPLATE.render(base=self.assets_url, url=exported_url.url) return self.TEMPLATE.render(base=self.assets_url, url=download_url.geturl())
def render(self): download_url = munge_url_for_localdev(self.metadata.download_url) return self.TEMPLATE.render(url=download_url.geturl())
def render(self): download_url = munge_url_for_localdev(self.metadata.download_url) safe_url = escape_url_for_template(download_url.geturl()) return self.TEMPLATE.render(url=safe_url)