Example #1
0
 def render(self):
     try:
         context = GLOBAL_TEMPLATE_CONTEXT.copy()
         context['entry'] = self
         _render(context, self.header.get('template', 'entry.html'),
                 self.header.get('template', self.destination))
         return True
     except Exception:  # pragma: no cover
         logger.exception("Found some problem with %s", self.path)
         sys.exit(1)
Example #2
0
 def render(self):
     try:
         context = GLOBAL_TEMPLATE_CONTEXT.copy()
         context['entry'] = self
         _render(context, self.header.get('template', 'entry.html'),
                 self.header.get('template', self.destination))
         return True
     except Exception:  # pragma: no cover
         logger.exception("Found some problem with %s", self.path)
         sys.exit(1)
Example #3
0
def update_index(entries):
    """find the last 10 entries in the database and create the main
    page.
    Each entry in has an eid, so we only get the last 10 eids.

    This method also updates the ATOM feed.
    """
    context = GLOBAL_TEMPLATE_CONTEXT.copy()
    context['entries'] = entries
    context['last_build'] = datetime.datetime.now().strftime(
        "%Y-%m-%dT%H:%M:%SZ")

    list(map(lambda x: _render(context, x[0],
                               os.path.join(CONFIG['output_to'], x[1])),
             (('entry_index.html', 'index.html'), ('atom.xml', 'atom.xml'))))
Example #4
0
def update_index(entries):
    """find the last 10 entries in the database and create the main
    page.
    Each entry in has an doc_id, so we only get the last 10 doc_ids.

    This method also updates the ATOM feed.
    """
    context = GLOBAL_TEMPLATE_CONTEXT.copy()
    context['entries'] = entries
    context['last_build'] = datetime.datetime.now().strftime(
        "%Y-%m-%dT%H:%M:%SZ")

    list(
        map(
            lambda x: _render(context, x[0],
                              os.path.join(CONFIG['output_to'], x[1])),
            (('entry_index.html', 'index.html'), ('atom.xml', 'atom.xml'))))
Example #5
0
    def render(self):
        """Render html page and atom feed"""
        context = GLOBAL_TEMPLATE_CONTEXT.copy()
        context['tag'] = self
        entries = list(self.entries)
        entries.sort(key=operator.attrgetter('date'), reverse=True)
        context['entries'] = entries

        # render html page
        render_to = os.path.join(CONFIG['output_to'], 'tags', self.slug)
        if not os.path.exists(render_to):  # pragma: no coverage
            os.makedirs(render_to)
        _render(context, 'tag_index.html', os.path.join(render_to, 'index.html'))  # noqa

        # render atom.xml
        context['entries'] = context['entries'][:10]
        context['last_build'] = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")  # noqa

        _render(context, 'atom.xml', os.path.join(render_to, 'atom.xml'))
        return True
Example #6
0
    def render(self):
        """Render html page and atom feed"""
        context = GLOBAL_TEMPLATE_CONTEXT.copy()
        context['tag'] = self
        entries = list(self.entries)
        entries.sort(key=operator.attrgetter('date'), reverse=True)
        context['entries'] = entries

        # render html page
        render_to = os.path.join(CONFIG['output_to'], 'tags', self.slug)
        if not os.path.exists(render_to):  # pragma: no coverage
            os.makedirs(render_to)
        _render(context, 'tag_index.html',
                os.path.join(render_to, 'index.html'))  # noqa

        # render atom.xml
        context['entries'] = context['entries'][:10]
        context['last_build'] = datetime.datetime.now().strftime(
            "%Y-%m-%dT%H:%M:%SZ")  # noqa

        _render(context, 'atom.xml', os.path.join(render_to, 'atom.xml'))
        return True
Example #7
0
def render_archive(entries):
    """Creates the archive page"""
    context = GLOBAL_TEMPLATE_CONTEXT.copy()
    context['entries'] = entries
    _render(context, 'archive_index.html',
            os.path.join(CONFIG['output_to'], 'archive/index.html')),
Example #8
0
def render_archive(entries):
    """Creates the archive page"""
    context = GLOBAL_TEMPLATE_CONTEXT.copy()
    context['entries'] = entries
    _render(context, 'archive_index.html',
            os.path.join(CONFIG['output_to'], 'archive/index.html')),