Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor fixes

  • Loading branch information...
commit cc09c071a63466d709c8767e5eef80f4ebafa1e6 1 parent 26209f9
@snoyberg snoyberg authored
Showing with 13 additions and 16 deletions.
  1. +12 −16 Yesod/Yesod.hs
  2. +1 −0  scaffold/Settings_hs.cg
View
28 Yesod/Yesod.hs
@@ -55,7 +55,6 @@ import Control.Monad.Trans.Class (MonadTrans (..))
import Control.Failure (Failure)
import qualified Data.ByteString as S
import qualified Data.ByteString.Char8 as S8
-import qualified Network.Wai.Middleware.CleanPath
import qualified Data.ByteString.Lazy as L
import Data.Monoid
import Control.Monad.Trans.Writer
@@ -64,7 +63,6 @@ import Text.Hamlet
import Text.Cassius
import Text.Julius
import Web.Routes
-import Network.URI (unEscapeString)
#if TEST
import Test.Framework (testGroup, Test)
@@ -207,18 +205,18 @@ class Eq (Route a) => Yesod a where
-- | Add a trailing slash if it is missing. Empty string is left alone.
ats :: String -> String
ats [] = []
- ats s =
- if last s == '/' || dbs (reverse s)
- then s
- else s ++ "/"
+ ats t =
+ if last t == '/' || dbs (reverse t)
+ then t
+ else t ++ "/"
-- | Remove a trailing slash if the last piece has a period.
rts :: String -> String
rts [] = []
- rts s =
- if last s == '/' && dbs (tail $ reverse s)
- then init s
- else s
+ rts t =
+ if last t == '/' && dbs (tail $ reverse t)
+ then init t
+ else t
-- | Is there a period before a slash here?
dbs :: String -> Bool
@@ -239,8 +237,8 @@ class Eq (Route a) => Yesod a where
| anyButLast (== '.') x = [x]
| otherwise = [x, ""] -- append trailing slash
fixSegs (x:xs) = x : fixSegs xs
- anyButLast p [] = False
- anyButLast p [_] = False
+ anyButLast _ [] = False
+ anyButLast _ [_] = False
anyButLast p (x:xs) = p x || anyButLast p xs
-- | This function is used to store some static content to be served as an
@@ -317,8 +315,8 @@ applyLayout' title body = fmap chooseRep $ defaultLayout $ do
defaultErrorHandler :: Yesod y => ErrorResponse -> GHandler sub y ChooseRep
defaultErrorHandler NotFound = do
r <- waiRequest
- let path' = bsToChars $ pathInfo r
- applyLayout' "Not Found" [hamlet|
+ let path' = bsToChars $ W.pathInfo r
+ applyLayout' "Not Found"
#if GHC7
[hamlet|
#else
@@ -327,8 +325,6 @@ defaultErrorHandler NotFound = do
%h1 Not Found
%p $path'$
|]
- where
- pathInfo = W.pathInfo
defaultErrorHandler (PermissionDenied msg) =
applyLayout' "Permission Denied"
#if GHC7
View
1  scaffold/Settings_hs.cg
@@ -1,4 +1,5 @@
{-# LANGUAGE CPP #-}
+{-# LANGUAGE TemplateHaskell #-}
-- | Settings are centralized, as much as possible, into this file. This
-- includes database connection settings, static file locations, etc.
-- In addition, you can configure a number of different aspects of Yesod
Please sign in to comment.
Something went wrong with that request. Please try again.