This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap".
The branch, 0.5 has been updated
via f79699a12f9e45c9327feaa6d30c2231bb0df0e7 (commit)
from cf45253e0ccb57245313486e54972f034fb7a193 (commit)
Summary of changes:
project_template/default/src/Application.hs | 2 +-
src/Snap/Extension/Heist/Impl.hs | 22 ++++++++++++++++------
test/snap-testsuite.cabal | 2 +-
3 files changed, 18 insertions(+), 8 deletions(-)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f79699a12f9e45c9327feaa6d30c2231bb0df0e7
Author: Mighty Byte <[email protected]>
Date: Fri Mar 4 15:06:45 2011 -0500
Added splices parameter to heistInitializer so user can define splices that
persist through reloads.
diff --git a/project_template/default/src/Application.hs
b/project_template/default/src/Application.hs
index 0b927a7..d1f5f63 100644
--- a/project_template/default/src/Application.hs
+++ b/project_template/default/src/Application.hs
@@ -53,6 +53,6 @@ instance HasTimerState ApplicationState where
-- to worry about.
applicationInitializer :: Initializer ApplicationState
applicationInitializer = do
- heist <- heistInitializer "resources/templates"
+ heist <- heistInitializer "resources/templates" []
timer <- timerInitializer
return $ ApplicationState heist timer
diff --git a/src/Snap/Extension/Heist/Impl.hs b/src/Snap/Extension/Heist/Impl.hs
index 8631df5..2112011 100644
--- a/src/Snap/Extension/Heist/Impl.hs
+++ b/src/Snap/Extension/Heist/Impl.hs
@@ -119,12 +119,17 @@ class MonadSnap m => HasHeistState m s | s -> m where
------------------------------------------------------------------------------
--- | The 'Initializer' for 'HeistState'. It takes one argument, a path to a
--- template directory containing @.tpl@ files.
-heistInitializer :: MonadSnap m => FilePath -> Initializer (HeistState m)
-heistInitializer p = do
+-- | The 'Initializer' for 'HeistState'.
+heistInitializer :: MonadSnap m
+ => FilePath
+ -- ^ Path to a template directory containing @.tpl@ files
+ -> [(Text, Splice m)]
+ -- ^ List of splices to make available to the templates
+ -> Initializer (HeistState m)
+heistInitializer p splices = do
heistState <- liftIO $ do
- (origTs,sts) <- bindStaticTag $ emptyTemplateState p
+ (origTs,sts) <- bindStaticTag $ bindSplices splices
+ $ emptyTemplateState p
loadTemplates p origTs >>= either error (\ts -> do
tsMVar <- newMVar ts
return $ HeistState p origTs tsMVar sts id)
@@ -183,7 +188,12 @@ renderHelper hs c t = do
------------------------------------------------------------------------------
-- | Take your application's state and register these splices in it so
-- that you don't have to re-list them in every handler. Should be called from
--- inside your application's 'Initializer'.
+-- inside your application's 'Initializer'. The splices registered by this
+-- function do not persist through template reloads. Those splices must be
+-- passed as a parameter to heistInitializer.
+--
+-- (NOTE: In the future we may decide to deprecate registerSplices in favor of
+-- the heistInitializer argument.)
--
-- Typical use cases are dynamically generated components that are present in
-- many of your views.
diff --git a/test/snap-testsuite.cabal b/test/snap-testsuite.cabal
index 972c870..393712a 100644
--- a/test/snap-testsuite.cabal
+++ b/test/snap-testsuite.cabal
@@ -14,7 +14,7 @@ Executable testsuite
directory,
filepath,
HUnit >= 1.2 && < 2,
- http-enumerator >= 0.2.1.5 && <0.3,
+ http-enumerator >= 0.3 && <0.4,
process == 1.*,
test-framework >= 0.3.1 && <0.4,
test-framework-hunit >= 0.2.5 && < 0.3,
-----------------------------------------------------------------------
hooks/post-receive
--
snap
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap