Exemplo n.º 1
0
    def get_illustrations(self, default=[]):

        figures = BioDesDoc.get_illustrations(self)
        images_cache_local = ''
        images_cache_url = ''
        prefix = self.get_source().id
        if self.repository:
            images_cache_local = self.repository.images_cache_local
            images_cache_url = self.repository.images_cache_url
        result = []
        for figure in figures:
            url, caption = figure
            if not caption:
                caption = 'illustratie uit %s' % self.get_source().description
            if (not url.startswith('http://')) and (not url.startswith('file://')):
                # this is a relative url
                url = '/'.join((os.path.dirname(self.source_url), url))
                if not url.startswith('file://'):
                    url = 'file://' + url
            result.append(Illustration(
                 url=url,
                 images_cache_local=images_cache_local,
                 images_cache_url=images_cache_url,
                 prefix=prefix,
                 caption=caption,
                 link_url=self.get_value('url_biografie'),
                 ))
        return result