Permalink
Browse files

moved getMimeTypeForExtension from State to Framework.

  • Loading branch information...
1 parent e8d5c65 commit 9ffbb78324319aea39b842090f8f29d6495625c1 @jgm committed Jan 31, 2009
Showing with 8 additions and 8 deletions.
  1. +8 −0 Gitit/Framework.hs
  2. +0 −8 Gitit/State.hs
View
@@ -37,13 +37,15 @@ module Gitit.Framework (
, urlForPage
, pathForPage
, withCommands
+ , getMimeTypeForExtension
)
where
import HAppS.Server hiding (look, lookRead, lookCookieValue, mkCookie)
import Gitit.HAppS (look, lookRead, lookCookieValue)
import Gitit.State
import Text.Pandoc.Shared (substitute)
import Control.Monad.Reader (mplus)
+import Data.Char (toLower)
import Data.DateTime
import Control.Monad.Trans (MonadIO)
import qualified Data.ByteString.Lazy as B
@@ -269,4 +271,10 @@ withCommands meth commands page = withRequest $ \req -> do
then page (intercalate "/" $ rqPaths req) req
else noHandle
+getMimeTypeForExtension :: MonadIO m => String -> m String
+getMimeTypeForExtension ext = do
+ mimes <- queryAppState mimeMap
+ return $ case M.lookup (dropWhile (=='.') $ map toLower ext) mimes of
+ Nothing -> "application/octet-stream"
+ Just t -> t
View
@@ -32,7 +32,6 @@ import Control.Monad (replicateM, liftM)
import Control.Exception (try, throwIO)
import Data.FileStore
import Data.List (intercalate)
-import Data.Char (toLower)
import Text.XHtml (Html)
import qualified Text.StringTemplate as T
import Gitit.HAppS (readMimeTypesFile)
@@ -252,12 +251,5 @@ getConfig = queryAppState config
getFileStore :: MonadIO m => m FileStore
getFileStore = queryAppState filestore
-getMimeTypeForExtension :: MonadIO m => String -> m String
-getMimeTypeForExtension ext = do
- mimes <- queryAppState mimeMap
- return $ case M.lookup (dropWhile (=='.') $ map toLower ext) mimes of
- Nothing -> "application/octet-stream"
- Just t -> t
-
getDefaultPageType :: MonadIO m => m PageType
getDefaultPageType = liftM defaultPageType (queryAppState config)

0 comments on commit 9ffbb78

Please sign in to comment.