Beispiel #1
0
    def build(self):
        logging.info(_("  XHTML %s") % os.path.basename(self.page_path))
        logging.debug("(%s)" % self.page_path)

        values = self.init_tpl_values()

        # Breadcrumbs (current is static, see dirindex.thtml, that's why the
        # last item of the list is removed).
        values['webgal_path'] = tplvars.Webgal(self, self.dir).path()[:-1]

        if not self.dir.source_dir.is_album_root():
            # Parent index link not for album root
            values['parent_index_link'] = self._get_related_index_fn()

        values['osize_index_links'] = self._get_osize_links(self._get_paginated_name())
        values['onum_index_links'] = self._get_onum_links()

        if self.dir.flatten_below():
            values['subgal_links'] = []
        else:
            values['subgal_links'] = self._get_subgal_links()

        values['medias'] = []
        for subdir, medias in self.galleries:
            info = tplvars.Webgal(self, subdir).info()
            if self.size_name in subdir.browse_sizes:
                media_links = [tplvars.media_vars(self, media).full()
                               for media in medias]
            else:
                # This happens when this dir index size is not available in the
                # subdir.
                media_links = []
            values['medias'].append((info, media_links, ))

        values.update(tplvars.Webgal(self, self.dir).info())

        values['rel_root'] = pathutils.url_path(self.dir.source_dir.rel_root()) + '/'
        values['rel_path'] = pathutils.url_path(self.dir.source_dir.strip_root())

        if self.dir.feed is not None:
            values['feed_url'] = os.path.relpath(self.dir.feed.path,
                                                 self.dir.path)
            values['feed_url'] = pathutils.url_path(values['feed_url'])
            values['feed_url'] = self.url_quote(values['feed_url'])
        else:
            values['feed_url'] = None

        self.page_template.dump(values, self.page_path)
Beispiel #2
0
 def add_extra_vals(self, tpl_values):
     tpl_values.update(tplvars.media_vars(self, self.webalbum_media).full())