Permalink
Browse files

Generate a context on every HTTP request

  • Loading branch information...
1 parent 91fb374 commit c06482016229171ee29a0cf53b170252defdea9e @VictorNicollet committed Sep 25, 2012
Showing with 5 additions and 4 deletions.
  1. +2 −2 ohmStatic/ohmStatic.ml
  2. +3 −2 ohmStatic/ohmStatic.mli
View
@@ -78,8 +78,8 @@ let prefixed_render ~default list info =
in
page info
-let with_context ctx page info =
- Run.with_context ctx (page info)
+let with_context make_ctx arg page info =
+ Run.with_context (make_ctx arg) (page info)
let export ?(rename=canonical) ?(render=default_render) ?(public="/") ~server ~title site =
View
@@ -92,9 +92,10 @@ val prefixed_render :
(** Provide a context for rendering. This turns a renderer with an arbitrary
context into a unit-context renderer as expected by the {!val:export}
- function.
+ function. You are expected to provide a function that returns the context
+ (so that the exporter can generate a new context on demand).
*)
-val with_context : 'ctx -> 'ctx renderer -> unit renderer
+val with_context : ('arg -> 'ctx) -> 'arg -> 'ctx renderer -> unit renderer
(** Export a static site.
@param rename A function that provides the path of each item. By default,

0 comments on commit c064820

Please sign in to comment.