diff options
author | 2013-06-03 16:33:05 -0400 | |
---|---|---|
committer | 2013-06-03 18:14:22 -0400 | |
commit | 69a819844c4f062e4ed21d183bbce091c39ee7f8 (patch) | |
tree | c5a78d8af3d5dff45b1db3bb3c3f49efb57174ea | |
parent | c4e38c013f61d9b3482eb5592619e619d67b9146 (diff) |
now builds with both yesod 1.2 and 1.1
-rw-r--r-- | Utility/WebApp.hs | 8 | ||||
-rw-r--r-- | Utility/Yesod.hs | 19 | ||||
-rw-r--r-- | git-annex.cabal | 2 |
3 files changed, 19 insertions, 10 deletions
diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs index 240d097b0..f3c0d3a6b 100644 --- a/Utility/WebApp.hs +++ b/Utility/WebApp.hs @@ -178,7 +178,11 @@ lookupRequestField k req = fromMaybe "" . lookup k $ Wai.requestHeaders req {- Rather than storing a session key on disk, use a random key - that will only be valid for this run of the webapp. -} +#if MIN_VERSION_yesod(1,2,0) webAppSessionBackend :: Yesod.Yesod y => y -> IO (Maybe Yesod.SessionBackend) +#else +webAppSessionBackend :: Yesod.Yesod y => y -> IO (Maybe (Yesod.SessionBackend y)) +#endif webAppSessionBackend _ = do g <- newGenIO :: IO SystemRandom case genBytes 96 g of @@ -218,7 +222,11 @@ genRandomToken = do - Note that the usual Yesod error page is bypassed on error, to avoid - possibly leaking the auth token in urls on that page! -} +#if MIN_VERSION_yesod(1,2,0) checkAuthToken :: (Monad m, Yesod.MonadHandler m) => (Yesod.HandlerSite m -> T.Text) -> m Yesod.AuthResult +#else +checkAuthToken :: forall t sub. (t -> T.Text) -> Yesod.GHandler sub t Yesod.AuthResult +#endif checkAuthToken extractToken = do webapp <- Yesod.getYesod req <- Yesod.getRequest diff --git a/Utility/Yesod.hs b/Utility/Yesod.hs index ef9ad5fc5..e437326b0 100644 --- a/Utility/Yesod.hs +++ b/Utility/Yesod.hs @@ -8,20 +8,21 @@ - Licensed under the GNU GPL version 3 or higher. -} -{-# LANGUAGE CPP, RankNTypes #-} +{-# LANGUAGE CPP, RankNTypes, FlexibleContexts #-} module Utility.Yesod where +import Yesod +#if MIN_VERSION_yesod_default(1,2,0) +import Yesod.Core +#endif #ifndef __ANDROID__ import Yesod.Default.Util -import Language.Haskell.TH.Syntax +import Language.Haskell.TH.Syntax (Q, Exp) #if MIN_VERSION_yesod_default(1,1,0) import Data.Default (def) import Text.Hamlet #endif -#if MIN_VERSION_yesod_default(1,2,0) -import Yesod.Core -#endif widgetFile :: String -> Q Exp #if ! MIN_VERSION_yesod_default(1,1,0) @@ -39,10 +40,10 @@ hamletTemplate f = globFile "hamlet" f #endif {- Lift Handler to Widget -} -#if ! MIN_VERSION_yesod(1,2,0) -liftH :: forall t. Lift t => t -> Q Exp -liftH = lift -#else +#if MIN_VERSION_yesod(1,2,0) liftH :: Monad m => HandlerT site m a -> WidgetT site m a liftH = liftH +#else +liftH :: MonadLift base m => base a -> m a +liftH = lift #endif diff --git a/git-annex.cabal b/git-annex.cabal index a97ee3894..14d6da7a5 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -133,7 +133,7 @@ Executable git-annex if flag(Webapp) Build-Depends: - yesod, yesod-default, yesod-static, yesod-form, + yesod, yesod-default, yesod-static, yesod-form, yesod-core, case-insensitive, http-types, transformers, wai, wai-logger, warp, blaze-builder, crypto-api, hamlet, clientsession, aeson, template-haskell, data-default |