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  af809185dea151755f047d320cd141f92cba87ca (commit)
      from  cd590409ccd4318333bab77e920cb49a8388476d (commit)


Summary of changes:
 project_template/hint/src/Main.hs |   29 +++++++----------------------
 snap.cabal                        |    1 -
 src/Snap/Heist.hs                 |   12 ++----------
 src/Snap/Loader/Hint.hs           |    4 ++--
 4 files changed, 11 insertions(+), 35 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 af809185dea151755f047d320cd141f92cba87ca
Author: Shane <[email protected]>
Date:   Fri Jul 9 13:24:12 2010 +0100

    Made the necessary changes to make this work with the new Server/Config 
stuff.

diff --git a/project_template/hint/src/Main.hs 
b/project_template/hint/src/Main.hs
index d0af9d8..47e541b 100644
--- a/project_template/hint/src/Main.hs
+++ b/project_template/hint/src/Main.hs
@@ -1,18 +1,13 @@
 {-# LANGUAGE CPP, TemplateHaskell #-}
 module Main where
 
-import Data.Monoid        (mappend, mempty)
-
-import AppState           (cleanupAppState, loadAppState)
-import Site               (site)
-
-import Snap.Http.Server
-import Snap.Http.Server.Config
-
+import           AppState
+import           Site
+import           Snap.Http.Server
 #ifdef PRODUCTION
-import Snap.Loader.Static (loadSnapTH)
+import           Snap.Loader.Static
 #else
-import Snap.Loader.Hint   (loadSnapTH)
+import           Snap.Loader.Hint
 #endif
 
 -- This is the entry point for this web server application.  It
@@ -24,7 +19,7 @@ import Snap.Loader.Hint   (loadSnapTH)
 -- source files in development mode, relative to the current working
 -- directory when it is run.
 --
--- When compiled without the production flag only changes to the
+-- When compiled without the production flag, only changes to the
 -- libraries, your cabal file, or this file should require a recompile
 -- to be picked up.  Everything else is interpreted at runtime.  There
 -- are a few consequences of this.
@@ -56,16 +51,6 @@ import Snap.Loader.Hint   (loadSnapTH)
 -- change.
 main :: IO ()
 main = do
-    -- override the some of the defaults from Snap.Http.Server.Config
-    let defaultFlags = mempty { flagVerbose = True
-                              , flagAccessLog = Just "log/access.log"
-                              , flagErrorLog = Just "log/error.log"
-                              }
-
-    -- read command line args, and merge them with the defaults above
-    cmdLineFlags <- readFlagsFromCmdLineArgs
-    let conf = flagsToConfig $ defaultFlags `mappend` cmdLineFlags
-
     -- This is just about the same as calling a function:
     --
     -- loadSnap :: IO a
@@ -92,7 +77,7 @@ main = do
     (cleanup, snap) <- $(loadSnapTH 'loadAppState 'cleanupAppState 'site)
 
     -- Run the server
-    httpServeConfig conf snap
+    quickHttpServe snap
 
     -- Run the cleanup action before exiting
     cleanup
diff --git a/snap.cabal b/snap.cabal
index a7f2d73..b592d5d 100644
--- a/snap.cabal
+++ b/snap.cabal
@@ -44,7 +44,6 @@ Library
   hs-source-dirs: src
 
   exposed-modules:
-    Snap.Error,
     Snap.Heist,
     Snap.Loader.Static,
     Snap.Loader.Hint
diff --git a/src/Snap/Heist.hs b/src/Snap/Heist.hs
index 881d0ff..0a6525c 100644
--- a/src/Snap/Heist.hs
+++ b/src/Snap/Heist.hs
@@ -3,12 +3,8 @@
 -- Heist templates from Snap.
 module Snap.Heist where
 
-------------------------------------------------------------------------------
 import qualified Data.ByteString.Char8 as S
-
-import           Snap.Error
 import           Snap.Types
-
 import           Text.Templating.Heist
 
 
@@ -21,8 +17,7 @@ renderHtml = render "text/html; charset=utf-8"
 
 ------------------------------------------------------------------------------
 -- | Renders a template with the provided content type.  If the
--- template cannot be loaded, 'internalError' is called with an error
--- message.
+-- template cannot be loaded, 'pass' is called and the next handler is tried.
 render :: (MonadSnap m)
        => S.ByteString -- ^ the content type to include in the response
        -> TemplateState m -- ^ the TemplateState that contains the template
@@ -30,10 +25,7 @@ render :: (MonadSnap m)
        -> m ()
 render contentType ts template = do
     bytes <- renderTemplate ts template
-    flip (maybe missingTemplate) bytes $ \x -> do
+    flip (maybe pass) bytes $ \x -> do
         modifyResponse $ setContentType contentType
                        . setContentLength (fromIntegral $ S.length x)
         writeBS x
-  where
-    msg = S.append "Unable to load template: " template
-    missingTemplate = internalError msg
diff --git a/src/Snap/Loader/Hint.hs b/src/Snap/Loader/Hint.hs
index e32a1bb..7dbd97c 100644
--- a/src/Snap/Loader/Hint.hs
+++ b/src/Snap/Loader/Hint.hs
@@ -31,7 +31,7 @@ import           Prelude hiding (catch)
 import           System.Environment (getArgs)
 
 ------------------------------------------------------------------------------
-import           Snap.Error
+import           Snap.Http.Server
 import           Snap.Types
 import qualified Snap.Loader.Static as Static
 
@@ -149,7 +149,7 @@ hintSnap opts modules initialization cleanup handler = do
         interpreterResult <- liftIO loadAction
         case interpreterResult of
             Left err -> internalError $ format err
-            Right handlerAction -> catch500 handlerAction
+            Right handlerAction -> handlerAction
 
 
 ------------------------------------------------------------------------------
-----------------------------------------------------------------------


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

Reply via email to