Oh, that definitely sounds like a bug. I'll look into it.
On Wed, Jun 23, 2010 at 9:19 AM, Kevin Jardine <[email protected]> wrote: > Hi Doug, > > The issue in this case is not quite that as I only call renderTemplate once. > > This issue is that renderTemplate calls a splice function that I defined, but > when that splice function in turn calls evalTemplate or callTemplate, the > template state value I passed to renderTemplate is not the one inside the > Template monad. > > This is not a big issue as I am now using putTS to update the template state > to the value I am storing in my own monad. But I find this puzzling bacause I > had assumed that the template state I passed to renderTemplate would be the > one available to all the splice functions it evokes. > > But of course I don't fully understand how Heist is supposed to function. > > Cheers, > Kevin > > --- On Wed, 6/23/10, MightyByte <[email protected]> wrote: > >> From: MightyByte <[email protected]> >> Subject: Re: [Snap Framework] renderTemplate with XML fragments in Heist >> To: "Kevin Jardine" <[email protected]> >> Cc: "Gregory Collins" <[email protected]>, [email protected] >> Date: Wednesday, June 23, 2010, 2:45 PM >> Kevin, >> >> The TemplateState that has your loaded templates must be >> passed to >> renderTemplate every time you call it. If storing >> that value in the >> state maintained by MyMonad is convenient for you, then >> that is a fine >> approach. Eventually Snap will probably have a monad >> that does this >> for you. >> >> Doug Beardsley >> >> On Wed, Jun 23, 2010 at 5:22 AM, Kevin Jardine <[email protected]> >> wrote: >> > Hi Gregory, >> > >> > Fortunately I already knew that bit. >> > >> > It turns out that the problem was that the template >> store in my splice function did not contain the loaded >> templates. I'm not sure why. >> > >> > If I just do something like: >> > >> > ts <- getTS >> > >> > in a splice function called by renderTemplate, the >> templates I loaded and passed to renderTemplate do not seem >> to be there. >> > >> > So instead I keep a template store variable in MyMonad >> and use that instead. >> > >> > Now everything works as expected. >> > >> > Cheers, >> > Kevin >> > >> > --- On Wed, 6/23/10, Gregory Collins <[email protected]> >> wrote: >> > >> >> From: Gregory Collins <[email protected]> >> >> Subject: Re: [Snap Framework] renderTemplate with >> XML fragments in Heist >> >> To: "Kevin Jardine" <[email protected]> >> >> Cc: [email protected] >> >> Date: Wednesday, June 23, 2010, 12:00 AM >> >> Kevin Jardine <[email protected]> >> >> writes: >> >> >> >> > My error I think - I was assuming that >> loadTemplates >> >> loads template >> >> > directories recursively like StringTemplate, >> but in >> >> fact it appears >> >> > that it only loads templates in the given >> directory, >> >> correct? >> >> >> >> They load recursively but if a template is in >> "foo/bar.tpl" >> >> you have to >> >> address it as "foo/bar". >> >> >> >> G >> >> -- >> >> Gregory Collins <[email protected]> >> >> >> > >> > >> > >> > _______________________________________________ >> > Snap mailing list >> > [email protected] >> > http://mailman-mail5.webfaction.com/listinfo/snap >> > >> > > > > _______________________________________________ Snap mailing list [email protected] http://mailman-mail5.webfaction.com/listinfo/snap
