Login

Tag "context-processor"

Snippet List

Lazy context processor.

Sometimes you have context variables that are needed on many pages in a site, but not all. You only want them to be evaluated when actually needed, especially if they are expensive calculations that do DB queries etc. The pattern to use is shown: put a callable into the context, not the final value, and also wrap the callable with memoize_nullary.

  • template
  • contextprocessor
  • lazy
  • context-processor
  • memoize
Read More

3 snippets posted so far.