packages feed

yesod-core 1.4.28 → 1.4.29

raw patch · 3 files changed

+18/−2 lines, 3 filesdep ~blaze-markupPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: blaze-markup

API changes (from Hackage documentation)

+ Yesod.Core.Dispatch: getGetMaxExpires :: IO (IO Text)
+ Yesod.Core.Dispatch: toWaiAppYre :: YesodDispatch site => YesodRunnerEnv site -> Application
- Yesod.Core: class RenderRoute site => Yesod site where approot = ApprootRelative errorHandler = defaultErrorHandler defaultLayout w = do { p <- widgetToPageContent w; msgs <- getMessages; withUrlRenderer (\ _render_a1hFd -> do { id ((preEscapedText . pack) "<!DOCTYPE html>\n\ \<html><head><title>"); id (toHtml (pageTitle p)); id ((preEscapedText . pack) "</title>"); asHtmlUrl (pageHead p) _render_a1hFd; id ((preEscapedText . pack) "</head><body>"); mapM_ (\ (status_a1hFe, msg_a1hFf) -> do { id ((preEscapedText . pack) "<p class=\"message "); id (toHtml status_a1hFe); id ((preEscapedText . pack) "\">"); id (toHtml msg_a1hFf); id ((preEscapedText . pack) "</p>") }) msgs; asHtmlUrl (pageBody p) _render_a1hFd; id ((preEscapedText . pack) "</body></html>") }) } urlRenderOverride _ _ = Nothing urlParamRenderOverride y route params = addParams params <$> urlRenderOverride y route where addParams [] routeBldr = routeBldr addParams nonEmptyParams routeBldr = let routeBS = toByteString routeBldr qsSeparator = fromChar $ if elem '?' routeBS then '&' else '?' valueToMaybe t = if t == "" then Nothing else Just t queryText = map (id *** valueToMaybe) nonEmptyParams in copyByteString routeBS `mappend` qsSeparator `mappend` renderQueryText False queryText isAuthorized _ _ = return Authorized isWriteRequest _ = do { wai <- waiRequest; return $ W.requestMethod wai `notElem` ["GET", "HEAD", "OPTIONS", "TRACE"] } authRoute _ = Nothing cleanPath _ s = if corrected == s then Right $ map dropDash s else Left corrected where corrected = filter (not . null) s dropDash t | all (== '-') t = drop 1 t | otherwise = t joinPath _ ar pieces' qs' = fromText ar `mappend` encodePath pieces qs where pieces = if null pieces' then [""] else map addDash pieces' qs = map (encodeUtf8 *** go) qs' go "" = Nothing go x = Just $ encodeUtf8 x addDash t | all (== '-') t = cons '-' t | otherwise = t addStaticContent _ _ _ = return Nothing maximumContentLength _ _ = Just $ 2 * 1024 * 1024 makeLogger _ = defaultMakeLogger messageLoggerSource site = defaultMessageLoggerSource $ shouldLogIO site jsLoader _ = BottomOfBody jsAttributes _ = [] makeSessionBackend _ = Just <$> defaultClientSessionBackend 120 defaultKeyFile fileUpload _ (KnownLength size) | size <= 50000 = FileUploadMemory lbsBackEnd fileUpload _ _ = FileUploadDisk tempFileBackEnd shouldLog _ = defaultShouldLog shouldLogIO a b c = return (shouldLog a b c) yesodMiddleware = defaultYesodMiddleware yesodWithInternalState _ _ = bracket createInternalState closeInternalState
+ Yesod.Core: class RenderRoute site => Yesod site where approot = ApprootRelative errorHandler = defaultErrorHandler defaultLayout w = do { p <- widgetToPageContent w; msgs <- getMessages; withUrlRenderer (\ _render_a1hFe -> do { id ((preEscapedText . pack) "<!DOCTYPE html>\n\ \<html><head><title>"); id (toHtml (pageTitle p)); id ((preEscapedText . pack) "</title>"); asHtmlUrl (pageHead p) _render_a1hFe; id ((preEscapedText . pack) "</head><body>"); mapM_ (\ (status_a1hFf, msg_a1hFg) -> do { id ((preEscapedText . pack) "<p class=\"message "); id (toHtml status_a1hFf); id ((preEscapedText . pack) "\">"); id (toHtml msg_a1hFg); id ((preEscapedText . pack) "</p>") }) msgs; asHtmlUrl (pageBody p) _render_a1hFe; id ((preEscapedText . pack) "</body></html>") }) } urlRenderOverride _ _ = Nothing urlParamRenderOverride y route params = addParams params <$> urlRenderOverride y route where addParams [] routeBldr = routeBldr addParams nonEmptyParams routeBldr = let routeBS = toByteString routeBldr qsSeparator = fromChar $ if elem '?' routeBS then '&' else '?' valueToMaybe t = if t == "" then Nothing else Just t queryText = map (id *** valueToMaybe) nonEmptyParams in copyByteString routeBS `mappend` qsSeparator `mappend` renderQueryText False queryText isAuthorized _ _ = return Authorized isWriteRequest _ = do { wai <- waiRequest; return $ W.requestMethod wai `notElem` ["GET", "HEAD", "OPTIONS", "TRACE"] } authRoute _ = Nothing cleanPath _ s = if corrected == s then Right $ map dropDash s else Left corrected where corrected = filter (not . null) s dropDash t | all (== '-') t = drop 1 t | otherwise = t joinPath _ ar pieces' qs' = fromText ar `mappend` encodePath pieces qs where pieces = if null pieces' then [""] else map addDash pieces' qs = map (encodeUtf8 *** go) qs' go "" = Nothing go x = Just $ encodeUtf8 x addDash t | all (== '-') t = cons '-' t | otherwise = t addStaticContent _ _ _ = return Nothing maximumContentLength _ _ = Just $ 2 * 1024 * 1024 makeLogger _ = defaultMakeLogger messageLoggerSource site = defaultMessageLoggerSource $ shouldLogIO site jsLoader _ = BottomOfBody jsAttributes _ = [] makeSessionBackend _ = Just <$> defaultClientSessionBackend 120 defaultKeyFile fileUpload _ (KnownLength size) | size <= 50000 = FileUploadMemory lbsBackEnd fileUpload _ _ = FileUploadDisk tempFileBackEnd shouldLog _ = defaultShouldLog shouldLogIO a b c = return (shouldLog a b c) yesodMiddleware = defaultYesodMiddleware yesodWithInternalState _ _ = bracket createInternalState closeInternalState

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.4.29++* Exports some internals and fix version bounds [#1318](https://github.com/yesodweb/yesod/pull/1318)+ ## 1.4.28  * Add ToWidget instances for strict text, lazy text, and text builder [#1310](https://github.com/yesodweb/yesod/pull/1310)
Yesod/Core/Dispatch.hs view
@@ -17,6 +17,8 @@     , mkYesodSubData     , mkYesodDispatch     , mkYesodSubDispatch+      -- *** Helpers+    , getGetMaxExpires       -- ** Path pieces     , PathPiece (..)     , PathMultiPiece (..)@@ -24,6 +26,7 @@       -- * Convert to WAI     , toWaiApp     , toWaiAppPlain+    , toWaiAppYre     , warp     , warpDebug     , warpEnv@@ -93,6 +96,11 @@             , yreGetMaxExpires = getMaxExpires             } +-- | Pure low level function to construct WAI application. Usefull+-- when you need not standard way to run your app, or want to embed it+-- inside another app.+--+-- @since 1.4.29 toWaiAppYre :: YesodDispatch site => YesodRunnerEnv site -> W.Application toWaiAppYre yre req =     case cleanPath site $ W.pathInfo req of@@ -237,6 +245,10 @@                 Nothing -> error $ "warpEnv: invalid PORT environment variable: " ++ show portS                 Just port -> warp port site +-- | Default constructor for 'yreGetMaxExpires' field. Low level+-- function for simple manual construction of 'YesodRunnerEnv'.+--+-- @since 1.4.29 getGetMaxExpires :: IO (IO Text) getGetMaxExpires = mkAutoUpdate defaultUpdateSettings   { updateAction = getCurrentMaxExpiresRFC1123
yesod-core.cabal view
@@ -1,5 +1,5 @@ name:            yesod-core-version:         1.4.28+version:         1.4.29 license:         MIT license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>@@ -56,7 +56,7 @@                    , resourcet             >= 0.4.9    && < 1.2                    , lifted-base           >= 0.1.2                    , blaze-html            >= 0.5-                   , blaze-markup          >= 0.5.1+                   , blaze-markup          >= 0.7.1                    , data-default                    , safe                    , warp                  >= 3.0.2