def preprocess_source(self, source): """Prepares a source entity for rendering in the source.html template. - convert image URLs to https if we're serving over SSL - set 'website_links' attr to list of pretty HTML links to domain_urls Args: source: :class:`models.Source` entity """ if source.picture: source.picture = util.update_scheme(source.picture, self) source.website_links = [ util.pretty_link(url, attrs={'rel': 'me', 'class': 'u-url'}) for url in source.domain_urls] return source
def preprocess_source(self, source): """Prepares a source entity for rendering in the source.html template. - use id as name if name isn't provided - convert image URLs to https if we're serving over SSL - set 'website_links' attr to list of pretty HTML links to domain_urls Args: source: :class:`models.Source` entity """ if not source.name: source.name = source.key.string_id() if source.picture: source.picture = util.update_scheme(source.picture, self) source.website_links = [ util.pretty_link(url, attrs={'rel': 'me', 'class': 'u-url'}) for url in source.domain_urls] return source
def preprocess_source(self, source): """Prepares a source entity for rendering in the source.html template. - use id as name if name isn't provided - convert image URLs to https if we're serving over SSL - zip domain_urls and domains into website field, list of Website namedtuples with url and domain fields Args: source: Source entity """ if not source.name: source.name = source.key.string_id() if source.picture: source.picture = util.update_scheme(source.picture, self) source.websites = [Website(url=u, domain=d) for u, d in zip(source.domain_urls, source.domains)] return source
def preprocess_source(self, source): """Prepares a source entity for rendering in the source.html template. - use id as name if name isn't provided - convert image URLs to https if we're serving over SSL - set 'website_links' attr to list of pretty HTML links to domain_urls Args: source: Source entity """ if not source.name: source.name = source.key.string_id() if source.picture: source.picture = util.update_scheme(source.picture, self) source.website_links = [ util.pretty_link(url, attrs={ 'rel': 'me', 'class': 'u-url' }) for url in source.domain_urls ] return source