firmant.globs

Setup Jinja2 globals (objects that should be available in Jinja2 templates).

Each Jinja2 writer will make the globals available in the context when rendering templates.

Functions

firmant.globs._sorted_posts(objects, newest_first=True)
Return a list of sorted posts from objects

Classes

class firmant.globs.AtomFeeds(environment, objects)

Bases: firmant.globs.Global

Add a list of the atom feeds, sorted by slug.

add_glob(globs, environment, objects)
Put a list of all static pages under the key atom_feeds.
class firmant.globs.DailyArchives(environment, objects)

Bases: firmant.globs.Global

Add a list of the SIDEBAR_POSTS_LEN most recent daily archives to globals.

add_glob(globs, environment, objects)
Put the list of daily archives under the key daily_archives.
class firmant.globs.Global(environment, objects)

Bases: firmant.chunks.AbstractChunk

Base class for other globals providers.

Globals inject themselves into the environment[Jinja2Base][‘globals’] dictionary.

:meth`__call__` will call add_glob() with a dictionary, the environment and the objects. The dictionary should be modified directly.

add_glob(globs, environment, objects)

Add the necessary globals to the dictionary globs.

This dictionary will be copied for use in each Jinja2 context.

class firmant.globs.MonthlyArchives(environment, objects)

Bases: firmant.globs.Global

Add a list of the SIDEBAR_POSTS_LEN most recent monthly archives to globals.

add_glob(globs, environment, objects)
Put the list of monthly archives under the key monthly_archives.
class firmant.globs.RecentPosts(environment, objects)

Bases: firmant.globs.Global

Add a list of the SIDEBAR_POSTS_LEN most recent posts to globals.

add_glob(globs, environment, objects)
Put the list of posts under the key recent_posts.
class firmant.globs.StaticPages(environment, objects)

Bases: firmant.globs.Global

Add a list of the static pages, sorted by title.

add_glob(globs, environment, objects)
Put a list of all static pages under the key static_pages.
class firmant.globs.URLFor(environment, objects)

Bases: firmant.globs.Global

Add the function urlfor() to globals.

The urlfor() is the url() method of a firmant.routingURLMapper object.

add_glob(globs, environment, objects)
Create the urlfor global.
class firmant.globs.YearlyArchives(environment, objects)

Bases: firmant.globs.Global

Add a list of the SIDEBAR_POSTS_LEN most recent yearly archives to globals.

add_glob(globs, environment, objects)
Put the list of yearly archives under the key yearly_archives.

Table Of Contents

Previous topic

firmant.du

Next topic

firmant.paginate

This Page