[Petal] petal:/tal: namespace

Jean-Michel Hiver jhiver@mkdoc.com
Mon, 7 Oct 2002 12:11:24 +0100


> Hello All,

Hi,


> I was wondering if/why there was a need for a seperate namespace
> (petal:) in Petal templates from Tal templates? I hit upon this trying
> to use some Tal templates in a Petal program. I was having a hard time
> finding examples of Petal templates and so grabbed some from articles
> on Tal. I could see a real advantage for the templates to be language
> neutral so that they could work both from Python and Perl. 

Well, Petal can be written in a way which is pretty much compatible with
TAL (TALES is another story).

Ideally the namespace should be declared and that's where you'll define
your prefix, so you'll be able to change it if you want. That's on my
TODO list.


> Is keeping things in sync between Tal and Petal a goal of the project?

No it isn't. The goal of the project is to make a useful library to
template any kind of XML and XHTML. The TAL spec was a good place to
start, it has plenty of really good ideas.

Now I had my own good ideas as well that I needed to integrate in this
library :-)

However, wherever I can, I try to make the library as TAL-compliant as I
can because it's good practice.


> What problems would there be in having language neutral templates? 

Unfortunately TAL is not that neutral, it's been designed for Zope. I
you limit yourself to the intersection of features between TAL and
Petal, you could very well write templates that run on both engines, but
you'll loose functionality for either side.

For example, Petal doesn't implement (yet) on-error attributes.

On the other hand, TAL doesn't let you write expressions such as:

  my/object --param1 variable --param2 "string_litteral"

Which IMHO is an annoying limitation. 


> I could at least see triggering an exception if the processer hits a
> tal attribute.

I don't understand... I don't see the point in doing that. After all you
might be using Petal to generate ZPT templates :-)


> I've been enjoying hacking though Petal. More to come on my adventures...

I'm glad that you like it!
Cheers,
-- 
IT'S TIME FOR A DIFFERENT KIND OF WEB
================================================================
  Jean-Michel Hiver - Software Director
  jhiver@mkdoc.com
  +44 (0)114 255 8097
================================================================
                                      VISIT HTTP://WWW.MKDOC.COM