On Wed, 2007-04-04 at 13:26 -0700, Mike Orr wrote: > Mako in contrast loads the template directly by pathname (in > lookup.py), and uses a caching library to store the compiled template. > This makes more sense although I presume it's not compatible with > zipped eggs. If the filename doesn't have a slash it first attempts > to convert it from dotted notation to URI notation.
This is also what Breve does. The dotted notation is something of a hangover from TurboGears' initial commitment to Kid which required dotted notation. FWIW, you can use the URI notation in TurboGears as well as Pylons, but it won't work for Kid (and possibly a few other template engines). > I'm thinking Buffet (pylons.templating) needs more formalization on > what the plugins should do, what notation, what the standard options > and their meanings are, etc. I've brought this up a few times. Most of the Buffet "specification" is simply documenting how TurboGears worked at the time (pre-1.0). Now that Buffet is being adopted outside TurboGears/CherryPy, some of the vagaries are being exposed. There is actually a mailing list devoted to this topic although it's barely alive at this point ([EMAIL PROTECTED]). This is where the initial Buffet spec was hammered out, but it's been fairly quiet since then. A few people (myself included) have discussed possible clarifications/enhancements but we've yet to gain any traction. > > > 1) Do you have a Pylons or TurboGears site that's using TurboCheetah? > > > > yes. we have one application powered by pylons/cheetah > > > > > 2) Would it be a hardship to convert your render_response or @expose > > > to URI notation? > > > > although replacing slashes with dots would be piece of cake what would > > be the gain? you'd still have to use "dotted notation" inside cheetah > > templates when you want to refer another template. > > The advantages of URI notation is you can use characters not allowed > in module names, you can name templates *.html, have two templates > A.html and A.xml for different output formats, and you wouldn't need > to have __init__.py in the template directories. Not to mention, a dot is a legal path character on most OS's, whereas a slash isn't. On my shared hosting boxes (and many others), it's common practice to name a user's home directory after their domain (e.g. /var/www/virtual/domain.com/) which can cause issues when using templates under that directory. > However, #extends needs a .py template module, so that's a major > argument in favor of dotted notation. > > The problem is that we're getting two different notation systems for > different types of templates. TurboCheetah, following Kid's and > Genshi's lead, uses dotted notation and requires __init__.py, even > though the templates aren't Python modules. Meanwhile, Myghty and > Mako and presumably future engines use URI notation. Dotted notation > makes sense for precompiled template modules, which I think Kid stores > in the same directory but Cheetah stores in a dict in memory. Mako > stores compiled templates in a completely different directory > (data/templates), or at least in Pylons it does. The purpose of > Buffet was to unify the template front-ends so you could switch from > one to another easily. But with them having different notations this > is difficult. My suggestion was that Buffet not care about how the "path" was specified, since the template might not even be stored on the filesystem (e.g. pulled from a database, a URL, etc): http://groups.google.com/group/pytemplates/browse_frm/thread/a26368ca1921ece0/954dbabfbeaad6cc?lnk=st&q=pytemplates&rnum=5#954dbabfbeaad6cc > Of course, there are tradeoffs both ways. It would be nice to just > change the engine argument and suddenly your template in the other > language works. I doubt this is even a remote possibility except for a couple corner cases (e.g. Kid to Genshi). Most of the engines are syntactically different enough that you'll need an entirely new template regardless, so changing a few path strings is a relatively minor addition to the overall workload. In short, I think a standard path notation is solving a non-existent problem (and bringing a lot of limitations and confusion with it). > But Mako and Genshi already have overlapping > extensions (*.html), and if every engine is using a site template of > some sort, all of those have to be uniquely named or kept in their own > directories. When I'm choosing between two template languages for the > same controller, I've gone to just having a separate render_request > line for each, and commenting the ones I'm not currently using. I > also put the engine argument in always, so the reader can immediately > tell which one is being used. Exactly. In this case the format of the path string matters little at all (and clearly I consider this the common case). Regards, Cliff --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
