withRevision fs rev'
$ do exists <- isFile path
if exists then
- return . Just =<< loadPage'
+ return . Just =<< loadPage' fs
else
return Nothing
where
path :: FilePath
path = mkPagePath name
- loadPage' :: Rev Page
- loadPage' = do mType <- liftM (fmap (read . chomp)) (getNodeProp path "svn:mime-type")
- case mType of
- Just (MIMEType "application" "x-rakka-redirection" _)
- -> loadPageRedirect
- _
- -> loadPageEntity
-
- loadPageEntity :: Rev Page
- loadPageEntity
+ loadPage' :: FileSystem -> Rev Page
+ loadPage' fs
+ = do mType <- liftM (fmap (read . chomp)) (getNodeProp path "svn:mime-type")
+ case mType of
+ Just (MIMEType "application" "x-rakka-redirection" _)
+ -> loadPageRedirect fs
+ _
+ -> loadPageEntity fs
+
+ loadPageEntity :: FileSystem -> Rev Page
+ loadPageEntity fs
= do props <- getNodePropList path
hist <- getNodeHistory True path
content <- getFileContentsLBS path
$ fromMaybe "text/x-rakka"
$ fmap chomp (lookup "svn:mime-type" props)
- lastMod <- getRevisionProp "svn:date"
+ lastMod <- unsafeIOToFS $
+ getRevisionProp' fs pageRev "svn:date"
>>= return . fromJust . parseW3CDateTime . chomp . fromJust
return Entity {
, entityUpdateInfo = undefined
}
- loadPageRedirect :: Rev Page
- loadPageRedirect
+ loadPageRedirect :: FileSystem -> Rev Page
+ loadPageRedirect fs
= do hist <- getNodeHistory True path
content <- getFileContents path
let pageRev = fst $ head hist
dest = chomp $ decodeString content
- lastMod <- getRevisionProp "svn:date"
+ lastMod <- unsafeIOToFS $
+ getRevisionProp' fs pageRev "svn:date"
>>= return . fromJust . parseW3CDateTime . chomp . fromJust
- isLocked <- getRevisionProp "rakka:isLocked"
+ isLocked <- getNodeProp path "rakka:isLocked"
>>= return . isJust
return Redirection {