Created
January 1, 2010 06:23
-
-
Save deepakjois/267062 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b4dba6068070b835b7d741d780751f36d3c1a575 Mon Sep 17 00:00:00 2001 | |
From: Deepak Jois <[email protected]> | |
Date: Thu, 31 Dec 2009 22:20:51 -0800 | |
Subject: [PATCH] Fixing issue with datadir not being used when reading data | |
--- | |
Yst/Data.hs | 10 +++++----- | |
Yst/Render.hs | 2 +- | |
2 files changed, 6 insertions(+), 6 deletions(-) | |
diff --git a/Yst/Data.hs b/Yst/Data.hs | |
index f8b0c61..89c6441 100644 | |
--- a/Yst/Data.hs | |
+++ b/Yst/Data.hs | |
@@ -28,14 +28,14 @@ import Data.Char | |
import Data.Maybe (fromMaybe) | |
import Data.List (sortBy, nub, isPrefixOf) | |
import Text.ParserCombinators.Parsec | |
-import System.FilePath (takeExtension) | |
+import System.FilePath (takeExtension, (</>)) | |
-getData :: DataSpec -> IO Node | |
-getData (DataFromFile file opts) = do | |
- raw <- catch (readDataFile file) | |
+getData :: Site -> DataSpec -> IO Node | |
+getData site (DataFromFile file opts) = do | |
+ raw <- catch (readDataFile $ dataDir site </> file) | |
(\e -> errorExit 15 ("Error reading data from " ++ file ++ ": " ++ show e) >> return undefined) | |
return $ foldl applyDataOption raw opts | |
-getData (DataConstant n) = return n | |
+getData site (DataConstant n) = return n | |
readDataFile :: FilePath -> IO Node | |
readDataFile f = | |
diff --git a/Yst/Render.hs b/Yst/Render.hs | |
index 2cb75c8..32057a3 100644 | |
--- a/Yst/Render.hs | |
+++ b/Yst/Render.hs | |
@@ -101,7 +101,7 @@ renderPage site page = do | |
let layout = fromMaybe (defaultLayout site) $ layoutFile page | |
srcDir <- canonicalizePath $ sourceDir site | |
g <- directoryGroup srcDir | |
- attrs <- forM (pageData page) $ \(k, v) -> getData v >>= \n -> return (k,n) | |
+ attrs <- forM (pageData page) $ \(k, v) -> getData site v >>= \n -> return (k,n) | |
todaysDate <- liftM utctDay getCurrentTime | |
rawContents <- | |
case sourceFile page of | |
-- | |
1.6.4.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment