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, master has been updated
       via  0874190e396d148b2e221fd8053e5d63839e0b79 (commit)
      from  09c6d4c1d3a6fd7a12a33b06712796b7fdc18222 (commit)


Summary of changes:
 src/Snap/Heist.hs |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 src/Snap/Heist.hs

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 0874190e396d148b2e221fd8053e5d63839e0b79
Author: Carl Howells <[email protected]>
Date:   Fri Jun 25 12:50:49 2010 -0700

    Add file I forgot to include in the last commit

diff --git a/src/Snap/Heist.hs b/src/Snap/Heist.hs
new file mode 100644
index 0000000..fa4c674
--- /dev/null
+++ b/src/Snap/Heist.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Snap.Heist where
+
+import qualified Data.ByteString.Char8 as S
+
+import           Snap.Types
+import           Text.Templating.Heist
+
+
+render :: TemplateState Snap -> S.ByteString -> Snap ()
+render ts template = do
+    bytes <- renderTemplate ts template
+    flip (maybe missingTemplate) bytes $ \x -> do
+        modifyResponse $ setContentType "text/html; charset=utf-8"
+                       . setContentLength (fromIntegral $ S.length x)
+        writeBS x
+  where
+    missingTemplate = do
+        let msg = S.append "Unable to load template: " template
+        modifyResponse $ setContentType "text/plain; charset=utf-8"
+                       . setContentLength (fromIntegral $ S.length msg)
+                       . setResponseStatus 500 "Internal Server Error"
+        writeBS msg
-----------------------------------------------------------------------


hooks/post-receive
-- 
snap
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to