yesod-core 1.0.1.1 → 1.0.1.2
raw patch · 18 files changed
+49/−68 lines, 18 filesdep ~basedep ~bytestringdep ~containersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, bytestring, containers, hspec
API changes (from Hackage documentation)
- Yesod.Core: class RenderRoute a => Yesod a where approot = ApprootRelative errorHandler = defaultErrorHandler defaultLayout w = do { p <- widgetToPageContent w; mmsg <- getMessage; hamletToRepHtml (\ _render_avkX -> do { id ((preEscapedText . pack) "<!DOCTYPE html>\ \<html><head><style type="text/css">#synopsis details:not([open]) > ul { visibility: hidden; }</style><title>"); id (toHtml (pageTitle p)); id ((preEscapedText . pack) "</title>"); pageHead p _render_avkX; id ((preEscapedText . pack) "</head><body>"); maybeH mmsg (\ msg_avkY -> do { id ((preEscapedText . pack) "<p class=\"message\">"); id (toHtml msg_avkY); id ((preEscapedText . pack) "</p>") }) Nothing; pageBody p _render_avkX; id ((preEscapedText . pack) "</body></html>") }) } urlRenderOverride _ _ = Nothing isAuthorized _ _ = return Authorized isWriteRequest _ = do { wai <- waiRequest; return $ requestMethod wai `notElem` ["GET", "HEAD", "OPTIONS", "TRACE"] } authRoute _ = Nothing cleanPath _ s = if corrected == s then Right s else Left corrected where corrected = filter (not . null) s joinPath _ ar pieces' qs' = fromText ar `mappend` encodePath pieces qs where pieces = if null pieces' then [""] else pieces' qs = map (encodeUtf8 *** go) qs' go "" = Nothing go x = Just $ encodeUtf8 x addStaticContent _ _ _ = return Nothing cookiePath _ = "/" cookieDomain _ = Nothing maximumContentLength _ _ = 2 * 1024 * 1024 messageLogger a loc level msg = if level < logLevel a then return () else formatLogMessage loc level msg >>= putStrLn logLevel _ = LevelInfo gzipSettings _ = def jsLoader _ = BottomOfBody makeSessionBackend _ = do { key <- getKey defaultKeyFile; return $ Just $ clientSessionBackend key 120 }
+ Yesod.Core: class RenderRoute a => Yesod a where approot = ApprootRelative errorHandler = defaultErrorHandler defaultLayout w = do { p <- widgetToPageContent w; mmsg <- getMessage; hamletToRepHtml (\ _render_avr2 -> do { id ((preEscapedText . pack) "<!DOCTYPE html>\ \<html><head><style type="text/css">#synopsis details:not([open]) > ul { visibility: hidden; }</style><title>"); id (toHtml (pageTitle p)); id ((preEscapedText . pack) "</title>"); pageHead p _render_avr2; id ((preEscapedText . pack) "</head><body>"); maybeH mmsg (\ msg_avr3 -> do { id ((preEscapedText . pack) "<p class=\"message\">"); id (toHtml msg_avr3); id ((preEscapedText . pack) "</p>") }) Nothing; pageBody p _render_avr2; id ((preEscapedText . pack) "</body></html>") }) } urlRenderOverride _ _ = Nothing isAuthorized _ _ = return Authorized isWriteRequest _ = do { wai <- waiRequest; return $ requestMethod wai `notElem` ["GET", "HEAD", "OPTIONS", "TRACE"] } authRoute _ = Nothing cleanPath _ s = if corrected == s then Right s else Left corrected where corrected = filter (not . null) s joinPath _ ar pieces' qs' = fromText ar `mappend` encodePath pieces qs where pieces = if null pieces' then [""] else pieces' qs = map (encodeUtf8 *** go) qs' go "" = Nothing go x = Just $ encodeUtf8 x addStaticContent _ _ _ = return Nothing cookiePath _ = "/" cookieDomain _ = Nothing maximumContentLength _ _ = 2 * 1024 * 1024 messageLogger a loc level msg = if level < logLevel a then return () else formatLogMessage loc level msg >>= putStrLn logLevel _ = LevelInfo gzipSettings _ = def jsLoader _ = BottomOfBody makeSessionBackend _ = do { key <- getKey defaultKeyFile; return $ Just $ clientSessionBackend key 120 }
Files
- LICENSE +17/−22
- Yesod/Internal/Core.hs +1/−1
- test.hs +1/−1
- test/YesodCoreTest.hs +1/−1
- test/YesodCoreTest/Cache.hs +1/−1
- test/YesodCoreTest/CleanPath.hs +1/−1
- test/YesodCoreTest/ErrorHandling.hs +1/−1
- test/YesodCoreTest/Exceptions.hs +1/−1
- test/YesodCoreTest/InternalRequest.hs +9/−8
- test/YesodCoreTest/JsLoader.hs +1/−1
- test/YesodCoreTest/Links.hs +1/−1
- test/YesodCoreTest/Media.hs +1/−1
- test/YesodCoreTest/NoOverloadedStrings.hs +1/−1
- test/YesodCoreTest/Redirect.hs +1/−1
- test/YesodCoreTest/WaiSubsite.hs +1/−1
- test/YesodCoreTest/Widget.hs +1/−1
- test/test.hs +1/−1
- yesod-core.cabal +8/−23
LICENSE view
@@ -1,25 +1,20 @@-The following license covers this documentation, and the source code, except-where otherwise indicated.--Copyright 2010, Michael Snoyman. All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are met:+Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/ -* Redistributions of source code must retain the above copyright notice, this- list of conditions and the following disclaimer.+Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions: -* Redistributions in binary form must reproduce the above copyright notice,- this list of conditions and the following disclaimer in the documentation- and/or other materials provided with the distribution.+The above copyright notice and this permission notice shall be+included in all copies or substantial portions of the Software. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO-EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,-OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Yesod/Internal/Core.hs view
@@ -727,7 +727,7 @@ let host = "" -- fixme, properly lock sessions to client address decodeClientSession key now host val save sess' now' = do- -- fixme should we be caching this?+ -- We should never cache the IV! Be careful! iv <- liftIO CS.randomIV return [AddCookie def { setCookieName = sessionName
test.hs view
@@ -2,4 +2,4 @@ import qualified YesodCoreTest main :: IO ()-main = hspecX $ descriptions $ YesodCoreTest.specs+main = hspecX $ YesodCoreTest.specs
test/YesodCoreTest.hs view
@@ -15,7 +15,7 @@ import Test.Hspec -specs :: [Specs]+specs :: [Spec] specs = [ cleanPathTest , exceptionsTest
test/YesodCoreTest/Cache.hs view
@@ -35,7 +35,7 @@ Nothing <- cacheLookup key return () -cacheTest :: [Spec]+cacheTest :: Spec cacheTest = describe "Test.Cache" [ it "works" works
test/YesodCoreTest/CleanPath.hs view
@@ -62,7 +62,7 @@ getBarR = return $ RepPlain "bar" getPlainR = return $ RepPlain "plain" -cleanPathTest :: [Spec]+cleanPathTest :: Spec cleanPathTest = describe "Test.CleanPath" [ it "remove trailing slash" removeTrailingSlash
test/YesodCoreTest/ErrorHandling.hs view
@@ -52,7 +52,7 @@ _ <- error $ show x getHomeR -errorHandlingTest :: [Spec]+errorHandlingTest :: Spec errorHandlingTest = describe "Test.ErrorHandling" [ it "says not found" caseNotFound , it "says 'There was an error' before runRequestBody" caseBefore
test/YesodCoreTest/Exceptions.hs view
@@ -30,7 +30,7 @@ setHeader "foo" "bar" redirectWith status301 RootR -exceptionsTest :: [Spec]+exceptionsTest :: Spec exceptionsTest = describe "Test.Exceptions" [ it "500" case500 , it "redirect keeps headers" caseRedirect
test/YesodCoreTest/InternalRequest.hs view
@@ -10,7 +10,7 @@ import Yesod.Request (Request (..)) import Test.Hspec -randomStringSpecs :: [Spec]+randomStringSpecs :: Spec randomStringSpecs = describe "Yesod.Internal.Request.randomString" [ it "looks reasonably random" looksRandom , it "does not repeat itself" $ noRepeat 10 100@@ -30,7 +30,7 @@ g = error "test/YesodCoreTest/InternalRequest.g" -tokenSpecs :: [Spec]+tokenSpecs :: Spec tokenSpecs = describe "Yesod.Internal.Request.parseWaiRequest (reqToken)" [ it "is Nothing if sessions are disabled" noDisabledToken , it "ignores pre-existing token if sessions are disabled" ignoreDisabledToken@@ -55,7 +55,7 @@ r = parseWaiRequest' defaultRequest [("_TOKEN", "old")] True g -langSpecs :: [Spec]+langSpecs :: Spec langSpecs = describe "Yesod.Internal.Request.parseWaiRequest (reqLangs)" [ it "respects Accept-Language" respectAcceptLangs , it "respects sessions" respectSessionLang@@ -93,8 +93,9 @@ } [("_LANG", "en-SESSION")] False g -internalRequestTest :: [Spec]-internalRequestTest = descriptions [ randomStringSpecs- , tokenSpecs- , langSpecs- ]+internalRequestTest :: Spec+internalRequestTest = describe "Test.InternalRequestTest" + [ randomStringSpecs+ , tokenSpecs+ , langSpecs+ ]
test/YesodCoreTest/JsLoader.hs view
@@ -22,7 +22,7 @@ getHeadR :: Handler RepHtml getHeadR = defaultLayout $ addScriptRemote "load.js" -specs :: [Spec]+specs :: Spec specs = describe "Test.JsLoader" [ it "link from head" $ runner H $ do res <- request defaultRequest
test/YesodCoreTest/Links.hs view
@@ -20,7 +20,7 @@ getRootR :: Handler RepHtml getRootR = defaultLayout $ toWidget [hamlet|<a href=@{RootR}>|] -linksTest :: [Spec]+linksTest :: Spec linksTest = describe "Test.Links" [ it "linkToHome" case_linkToHome ]
test/YesodCoreTest/Media.hs view
@@ -49,7 +49,7 @@ assertStatus 200 res flip assertBody res "<!DOCTYPE html>\n<html><head><title></title><link rel=\"stylesheet\" href=\"all.css\"><link rel=\"stylesheet\" media=\"screen\" href=\"screen.css\"></head><body></body></html>" -mediaTest :: [Spec]+mediaTest :: Spec mediaTest = describe "Test.Media" [ it "media" caseMedia , it "media link" caseMediaLink
test/YesodCoreTest/NoOverloadedStrings.hs view
@@ -44,7 +44,7 @@ res <- request defaultRequest assertBody mempty res -noOverloadedTest :: [Spec]+noOverloadedTest :: Spec noOverloadedTest = describe "Test.NoOverloadedStrings" [ it "sanity" case_sanity ]
test/YesodCoreTest/Redirect.hs view
@@ -26,7 +26,7 @@ getR307 = redirectWith H.status307 RootR getRRegular = redirect RootR -specs :: [Spec]+specs :: Spec specs = describe "Redirect" [ it "301 redirect" $ app $ do res <- request defaultRequest { pathInfo = ["r301"] }
test/YesodCoreTest/WaiSubsite.hs view
@@ -25,7 +25,7 @@ getRootR :: Handler () getRootR = return () -specs :: [Spec]+specs :: Spec specs = describe "WaiSubsite" [ it "root" $ app $ do res <- request defaultRequest { pathInfo = [] }
test/YesodCoreTest/Widget.hs view
@@ -77,7 +77,7 @@ where someHtml = [shamlet|somehtml|] -widgetTest :: [Spec]+widgetTest :: Spec widgetTest = describe "Test.Widget" [ it "addJuliusBody" case_addJuliusBody , it "whamlet" case_whamlet
test/test.hs view
@@ -2,4 +2,4 @@ import qualified YesodCoreTest main :: IO ()-main = hspecX $ descriptions $ YesodCoreTest.specs+main = hspecX $ YesodCoreTest.specs
yesod-core.cabal view
@@ -1,5 +1,5 @@ name: yesod-core-version: 1.0.1.1+version: 1.0.1.2 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -42,27 +42,20 @@ flag blaze_html_0_5 description: use blaze-html 0.5 and blaze-markup 0.5- default: False--flag ghc7+ default: True library- if flag(ghc7)- build-depends: base >= 4.3 && < 5- cpp-options: -DGHC7- else- build-depends: base >= 4 && < 4.3- -- Work around a bug in cabal. Without this, wai-test doesn't get built and -- we have a missing dependency during --enable-tests builds. if flag(test) build-depends: wai-test - build-depends: time >= 1.1.4+ build-depends: base >= 4.3 && < 5+ , time >= 1.1.4 , yesod-routes >= 1.0 && < 1.1 , wai >= 1.2 && < 1.3 , wai-extra >= 1.2 && < 1.3- , bytestring >= 0.9.1.4 && < 0.10+ , bytestring >= 0.9.1.4 , text >= 0.7 && < 0.12 , template-haskell , path-pieces >= 0.1 && < 0.2@@ -78,7 +71,7 @@ , cereal >= 0.3 && < 0.4 , old-locale >= 1.0.0.2 && < 1.1 , failure >= 0.2 && < 0.3- , containers >= 0.2 && < 0.5+ , containers >= 0.2 , monad-control >= 0.3 && < 0.4 , transformers-base >= 0.4 , cookie >= 0.4 && < 0.5@@ -124,17 +117,9 @@ main-is: test.hs hs-source-dirs: test - if flag(ghc7)- type: exitcode-stdio-1.0- build-depends: base >= 4.3 && < 5- cpp-options: -DGHC7- main-is: test.hs- else- type: exitcode-stdio-1.0- build-depends: base >= 4 && < 4.3- main-is: test.hs cpp-options: -DTEST- build-depends: hspec >= 0.8 && < 0.10+ build-depends: base+ ,hspec >= 1.1 && < 1.2 ,wai-test ,wai ,yesod-core