about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorVincent Ambo <v.ambo@me.com>2012-03-18T22·49+0100
committerVincent Ambo <v.ambo@me.com>2012-03-18T22·49+0100
commitda388782122779e865fc5454e5182d95c7f8fa26 (patch)
tree15d02dbbdba7bda258fa2f9a690ec049803ceff1 /src
parent515660fa7deeeb6753768378e0cfa38a4616e03a (diff)
* correctly serving 404s with status code 404 :|
Diffstat (limited to 'src')
-rw-r--r--src/Blog.hs4
-rw-r--r--src/Locales.hs6
-rw-r--r--src/Main.hs12
3 files changed, 11 insertions, 11 deletions
diff --git a/src/Blog.hs b/src/Blog.hs
index d6b806985e..f481e578fd 100644
--- a/src/Blog.hs
+++ b/src/Blog.hs
@@ -237,9 +237,9 @@ editPage (Entry{..}) = adminTemplate "Index" $
 
 -- Error pages
 showError :: BlogError -> BlogLang -> Html
-showError NotFound l = blogTemplate l (T.append ": " $ notFound l) $ 
+showError NotFound l = blogTemplate l (T.append ": " $ notFoundTitle l) $ 
   H.div ! A.class_ "innerBox" $ do
-    H.div ! A.class_ "innerBoxTop" $ toHtml $ notFound l
+    H.div ! A.class_ "innerBoxTop" $ toHtml $ notFoundTitle l
     H.div ! A.class_ "innerBoxMiddle" $ do
         H.p ! A.class_ "notFoundFace" $ toHtml (":'(" :: Text)
         H.p ! A.class_ "notFoundText" $ toHtml $ notFoundText l
diff --git a/src/Locales.hs b/src/Locales.hs
index c1dc02453c..7d36b2d2b1 100644
--- a/src/Locales.hs
+++ b/src/Locales.hs
@@ -116,9 +116,9 @@ cSend DE = "Absenden"
 cSend EN = "Submit"
 
 -- errors
-notFound :: BlogLang -> Text
-notFound DE = "Nicht gefunden"
-notFound EN = "Not found"
+notFoundTitle :: BlogLang -> Text
+notFoundTitle DE = "Nicht gefunden"
+notFoundTitle EN = "Not found"
 
 notFoundText :: BlogLang -> Text
 notFoundText DE = "Das gewünschte Objekt wurde leider nicht gefunden."
diff --git a/src/Main.hs b/src/Main.hs
index f12c743494..ce423f932d 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -74,7 +74,7 @@ tazBlog acid =
          , dir "admin" $ ok $ toResponse $ adminLogin 
          , dir "dologin" $ processLogin acid
          , serveDirectory DisableBrowsing [] "../res"
-         , ok $ toResponse $ showError NotFound DE
+         , notFound $ toResponse $ showError NotFound DE
          ]
 
 blogHandler :: AcidState Blog -> BlogLang -> ServerPart Response
@@ -85,7 +85,7 @@ blogHandler acid lang =
                 \(eId :: Integer) -> addComment acid lang $ EntryId eId
          , do nullDir
               showIndex acid lang
-         , ok $ toResponse $ showError NotFound lang
+         , notFound $ toResponse $ showError NotFound lang
          ]
 
 formatOldLink :: Int -> Int -> String -> ServerPart Response
@@ -96,11 +96,11 @@ formatOldLink y m id_ =
 showEntry :: AcidState Blog -> BlogLang -> EntryId -> ServerPart Response
 showEntry acid lang eId = do
     entry <- query' acid (GetEntry eId)
-    ok $ tryEntry entry lang
+    tryEntry entry lang
 
-tryEntry :: Maybe Entry -> BlogLang -> Response
-tryEntry Nothing lang = toResponse $ showError NotFound lang
-tryEntry (Just entry) _ = toResponse $ blogTemplate eLang eTitle $ renderEntry entry
+tryEntry :: Maybe Entry -> BlogLang -> ServerPart Response
+tryEntry Nothing lang = notFound $ toResponse $ showError NotFound lang
+tryEntry (Just entry) _ = ok $ toResponse $ blogTemplate eLang eTitle $ renderEntry entry
     where
         eTitle = T.append ": " (title entry)
         eLang = lang entry