Thread: Re: [Cheetahtemplate-discuss] #include and 1.0
Brought to you by:
rtyler,
tavis_rudd
From: Rodrigo O. <rod...@ho...> - 2003-01-02 19:17:02
|
My point is that it will be easier for template writers if they weren't required to remember to do something like: #include raw source=os.path.join($application.path, 'spam.inc') instead of the simpler: #include raw 'spam.inc' Don't you think? Rodrigo >From: Tavis Rudd <ta...@re...> >To: "Rodrigo B. de Oliveira" <rod...@ho...>,"Cheetah Template >List" <che...@li...> >Subject: Re: [Cheetahtemplate-discuss] #include and 1.0 >Date: Thu, 2 Jan 2003 10:49:21 -0800 > >why don't you just resolve the path before passing it into Cheetah? > >On January 2, 2003 04:25 am, Rodrigo B. de Oliveira wrote: > > I'd like to see some way to override the filename resolution process a >lie > > SAX and XSLT URIResolver. I'm in the process of finishing a nice >framework > > for web development that has cheetah as the preferred presentation >engine > > and this is one of the things that are still preventing an easy and >elegant > > solution for end users. I can elaborate a little more on the problem if > > necessary. > > > > The solution would be something like: > > > > class MyPathResolver: > > def __init__(self, root): > > self._root = root > > def resolvePath(self, pathToResolve): > > import os > > return os.path.join(self._root, pathToResolve) > > > > pr = MyPathResolver("/path/to/templates/") > > t = Template(searchList=searchList, pathResolver=pr.resolvePath) > > > > Any include arguments would be resolved by the pathResolver callable. > > > > Would do you think? (Or am I totally missing the point here and there's >an > > alternative mechanism to specify a template searchPath?) > > > > I intend to provide the necessary patches and test cases if you all >agree > > this could be a good thing.\ > > > > Regards and happy new year! > > Rodrigo > > > > > > ----- Original Message ----- > > From: "Mike Orr" <ir...@ms...> > > To: "Cheetah Template List" ><che...@li...> > > Sent: Sunday, December 22, 2002 10:34 PM > > Subject: [Cheetahtemplate-discuss] #include and 1.0 > > > > > This is our last chance to make any changes to the #include interface > > > before 1.0. Some of us have expressed a desire to make it easier to > > > do raw includes (insert literal text) and harder to do parsed includes > > > (insert parsed text), especially accidentally. > > > > > > Currently, #include does a parsed include, and '#include raw' does a > > > literal include. > > > > > > An alternative would be to make raw include the default, and add a > > > keyword to do a parsed include (e.g., '#include parsed' or > > > '#include cheetah'). > > > > > > Is this worth doing or should we stick with what we have? > > > > > > -- > > > -Mike (Iron) Orr, ir...@ms... (if mail problems: ms...@oz...) > > > http://iron.cx/ English * Esperanto * Russkiy * Deutsch * >Espan~ol > > > > > > > > > ------------------------------------------------------- > > > This sf.net email is sponsored by:ThinkGeek > > > Welcome to geek heaven. > > > http://thinkgeek.com/sf > > > _______________________________________________ > > > Cheetahtemplate-discuss mailing list > > > Che...@li... > > > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Cheetahtemplate-discuss mailing list > > Che...@li... > > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Cheetahtemplate-discuss mailing list >Che...@li... >https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss _________________________________________________________________ MSN Hotmail, o maior webmail do Brasil. http://www.hotmail.com |
From: Tavis R. <ta...@re...> - 2003-01-02 19:29:04
|
oh, I get it now. I thought you were talking about initializing a templa= te=20 rather than including one. =20 I see the value in what you're proposing but wonder if it's simpler to ju= st=20 write a wrapper method that does this rather than extending the #include=20 directive. For example: $include('spam.inc') where the baseclass defines an appropriate implementation of the 'include= '=20 method. =20 Would that accomplish what you want? I think Cheetah's core syntax is flexible enough to facilitate this witho= ut=20 needing to be extended to cover such special cases. Tavis On January 2, 2003 11:16 am, Rodrigo Oliveira wrote: > My point is that it will be easier for template writers if they weren't > required to remember to do something like: > > #include raw source=3Dos.path.join($application.path, 'spam.inc') > > instead of the simpler: > > #include raw 'spam.inc' > > Don't you think? > > Rodrigo > > > From: Tavis Rudd <ta...@re...> > > >To: "Rodrigo B. de Oliveira" <rod...@ho...>,"Cheetah Temp= late > >List" <che...@li...> > >Subject: Re: [Cheetahtemplate-discuss] #include and 1.0 > >Date: Thu, 2 Jan 2003 10:49:21 -0800 > > > >why don't you just resolve the path before passing it into Cheetah? > > > >On January 2, 2003 04:25 am, Rodrigo B. de Oliveira wrote: > > > I'd like to see some way to override the filename resolution proces= s a > > > >lie > > > > > SAX and XSLT URIResolver. I'm in the process of finishing a nice > > > >framework > > > > > for web development that has cheetah as the preferred presentation > > > >engine > > > > > and this is one of the things that are still preventing an easy and > > > >elegant > > > > > solution for end users. I can elaborate a little more on the proble= m if > > > necessary. > > > > > > The solution would be something like: > > > > > > class MyPathResolver: > > > def __init__(self, root): > > > self._root =3D root > > > def resolvePath(self, pathToResolve): > > > import os > > > return os.path.join(self._root, pathToResolve) > > > > > > pr =3D MyPathResolver("/path/to/templates/") > > > t =3D Template(searchList=3DsearchList, pathResolver=3Dpr.resolvePa= th) > > > > > > Any include arguments would be resolved by the pathResolver callabl= e. > > > > > > Would do you think? (Or am I totally missing the point here and the= re's > > > >an > > > > > alternative mechanism to specify a template searchPath?) > > > > > > I intend to provide the necessary patches and test cases if you all > > > >agree > > > > > this could be a good thing.\ > > > > > > Regards and happy new year! > > > Rodrigo > > > > > > > > > ----- Original Message ----- > > > From: "Mike Orr" <ir...@ms...> > > > To: "Cheetah Template List" > > > ><che...@li...> > > > > > Sent: Sunday, December 22, 2002 10:34 PM > > > Subject: [Cheetahtemplate-discuss] #include and 1.0 > > > > > > > This is our last chance to make any changes to the #include inter= face > > > > before 1.0. Some of us have expressed a desire to make it easier= to > > > > do raw includes (insert literal text) and harder to do parsed > > > > includes (insert parsed text), especially accidentally. > > > > > > > > Currently, #include does a parsed include, and '#include raw' doe= s a > > > > literal include. > > > > > > > > An alternative would be to make raw include the default, and add = a > > > > keyword to do a parsed include (e.g., '#include parsed' or > > > > '#include cheetah'). > > > > > > > > Is this worth doing or should we stick with what we have? > > > > > > > > -- > > > > -Mike (Iron) Orr, ir...@ms... (if mail problems: ms...@oz...) > > > > http://iron.cx/ English * Esperanto * Russkiy * Deutsch * > > > >Espan~ol > > > > > > ------------------------------------------------------- > > > > This sf.net email is sponsored by:ThinkGeek > > > > Welcome to geek heaven. > > > > http://thinkgeek.com/sf > > > > _______________________________________________ > > > > Cheetahtemplate-discuss mailing list > > > > Che...@li... > > > > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-disc= uss > > > > > > ------------------------------------------------------- > > > This sf.net email is sponsored by:ThinkGeek > > > Welcome to geek heaven. > > > http://thinkgeek.com/sf > > > _______________________________________________ > > > Cheetahtemplate-discuss mailing list > > > Che...@li... > > > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discus= s > > > >------------------------------------------------------- > >This sf.net email is sponsored by:ThinkGeek > >Welcome to geek heaven. > >http://thinkgeek.com/sf > >_______________________________________________ > >Cheetahtemplate-discuss mailing list > >Che...@li... > >https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss > > _________________________________________________________________ > MSN Hotmail, o maior webmail do Brasil. http://www.hotmail.com |
From: <ir...@ms...> - 2003-01-02 23:51:52
|
On Thu, Jan 02, 2003 at 05:16:55PM -0200, Rodrigo Oliveira wrote: > My point is that it will be easier for template writers if they weren't > required to remember to do something like: > > #include raw source=os.path.join($application.path, 'spam.inc') > > instead of the simpler: > > #include raw 'spam.inc' Well, my *personal* opinion is not to use #include at all, but... I've been quiet on the list because my DSL has been going up and down since Friday. I'm getting 99% packet loss a lot of the time; the telco says it's hardware problems in their central office. I saw Edmund's question a couple days ago but haven't been able to reply, so I haven't read it yet. -- -Mike (Iron) Orr, ir...@ms... (if mail problems: ms...@oz...) http://iron.cx/ English * Esperanto * Russkiy * Deutsch * Espan~ol |
From: <ir...@ms...> - 2003-01-03 00:48:59
|
On Thu, Jan 02, 2003 at 03:52:32PM -0800, Mike Orr wrote: > On Thu, Jan 02, 2003 at 05:16:55PM -0200, Rodrigo Oliveira wrote: > > My point is that it will be easier for template writers if they weren't > > required to remember to do something like: > > > > #include raw source=os.path.join($application.path, 'spam.inc') > > > > instead of the simpler: > > > > #include raw 'spam.inc' > > Well, my *personal* opinion is not to use #include at all, but... Actually, that was too harsh. It's parsed includes I'm sceptical about, not raw includes. Especially parsed includes with complicated directives inside. -- -Mike (Iron) Orr, ir...@ms... (if mail problems: ms...@oz...) http://iron.cx/ English * Esperanto * Russkiy * Deutsch * Espan~ol |