473,598 Members | 3,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cheetah best for templating?

I have just finished reading Code Generation In Action which uses Ruby for
code generation. I would like to use Python instead. Is Cheetah the best
tool to use for templating source code files and then generating code? Is
there something more mature or better?

Thanks!

--
Roger Jack
Elegance Technologies, Inc.
484.431.1775
rj***@elegancet ech.com
www.elegancetech.com
Jul 18 '05 #1
5 2085
Roger Jack:
Is Cheetah the best tool to use for templating source code files
and then generating code?


I've choosen it for a project recently and IMO it's a good templating
system.

It would be good to get a little more guidance for using it in an easy
PHP-way with mod_python, but other than that I have no gripes.

--
René Pijlman
Jul 18 '05 #2
Roger Jack wrote:
I have just finished reading Code Generation In Action which uses Ruby
for
code generation. I would like to use Python instead. Is Cheetah the
best
tool to use for templating source code files and then generating code?
Is
there something more mature or better?


I tend to think highly of EmPy, but that's not exactly a surprise :-):

http://www.alcyone.com/software/empy/

I do know that there are several people on the EmPy mailing list using
EmPy for exactly the purpose you're considering.

What's going to be best for you is really going to depend on your
aesthetic sensibilities; pretty much all of templating systems' base
features are universal, just expressed in different ways. The only
thing that might objectively make one system better than another for you
would be ancillary features which are included on top.

--
__ Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ Granted that I must die, how shall I live?
-- Michael Novak
Jul 18 '05 #3
"Roger Jack" <rj***@elegance tech.com> wrote in message news:<CM******* *************@c omcast.com>...
I have just finished reading Code Generation In Action which uses Ruby for
code generation. I would like to use Python instead. Is Cheetah the best
tool to use for templating source code files and then generating code? Is
there something more mature or better?


I had a project where I wanted to generate some pro*c + C++ database code.
I found that the Python Template Language that comes with Quixote was
very convenient for this purpose, because it avoids needing to learn
another syntax.

Quixote: http://www.mems-exchange.org/software/quixote/
PTL: http://www.mems-exchange.org/softwar...e/doc/PTL.html

Regards,
Giles
Jul 18 '05 #4
"Roger Jack" <rj***@elegance tech.com> writes:
I have just finished reading Code Generation In Action which uses Ruby for
code generation. I would like to use Python instead. Is Cheetah the best
tool to use for templating source code files and then generating code? Is
there something more mature or better?


My graphist and me found it excellent, fast, clear, simple, stable : Pythonic !

We found the others engines too verbose, more perlish ;-)

Like python, the best is to try somes engines, you will see quickly wich
one you need. First, like everybody, i did my own engine, but Cheetah
was finaly a better wheel !

I use it to generate html, latex and xml

--
Wilk - http://flibuste.net
Jul 18 '05 #5
Erik Max Francis <ma*@alcyone.co m> writes:
I tend to think highly of EmPy, but that's not exactly a surprise :-):
<aol>Me too!</aol>
http://www.alcyone.com/software/empy/

I do know that there are several people on the EmPy mailing list using
EmPy for exactly the purpose you're considering.
Including yours truly. Also, the source code generation problem might
be solved trivially by checking out

http://www.students.tut.fi/~vainio24/pywiz/
What's going to be best for you is really going to depend on your
aesthetic sensibilities; pretty much all of templating systems' base
features are universal, just expressed in different ways. The only


Also, there is very little to lose by taking a cursory glance at each
one and choosing what seems easiest (assuming they have the same level
of power).

Short EmPy tutorial:

---------- myfile.em -------------------

@{
# statements
import time
var1 = 12
var2 = "Hello"
}

@var2 World! @var1 plus one is @(var1+1)
------------------------------------------

python em.py myfile.em > output.txt

--
Ville Vainio http://www.students.tut.fi/~vainio24
Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4505
by: Wm | last post by:
As an amateur wannabe-pro programmer, I am trying to learn not only how to use PHP but how to do it *efficiently*. (Trust me, you don't wanna see some of my stuff!!!) I'm noticing a number of my pages have a mixture of HTML and PHP, very interspersed. Example: A form with 20 fields where I echo a variable in each field to show existing data. My question is really about the best practice to do this, as I have seen some interesting use of...
3
1951
by: Timo Virkkala | last post by:
I tried to install Cheetah (0.9.15) and ran into trouble. When running the test suite, I get 61 failures and 57 errors. Most of the errors are "ImportError: No module named temp", with some "TypeError: update() takes exactly one argument (0 given)". The full output of the test suite is at (URL: http://www.cs.helsinki.fi/u/tjvirkka/out.txt ) I'd hate to spend hours debugging this thing, so I thought to ask here if someone has any ideas...
13
3512
by: Charlotte | last post by:
I am developing a web application and am looking for the best framework to do this in. I know this is an old question, and I have read the list archives and a couple of comparison pages on the web. I played around with some, and I have reduced my choices to two very different frameworks: cherrypy+cheetah and twisted+nevow. I am writing the prototype in cherrypy with cheetah, and I like it very much. I am very impressed with the speed of...
0
914
by: ajay.padala | last post by:
Hi I would like to be able to get the inputs that are needed into a template file programmatically. For example if we had a template: ===================== $name has $num marbles in his hand. =====================
2
1369
by: Sai Krishna M | last post by:
Hi, I have been working for some time developing web pages using python, modpython, cheetah. I find that this method has come inherent difficulties in it like if we want to generate a single page we have to write two separate files ( py & tmpl). Is there any other better way of doing things.? Also if we want to have partial processing of the pages, i.e, the
0
1189
by: manuel.reil | last post by:
Hello, currently i am developing a very small cms using python and cheetah. very early i have noticed that i was lacking the method to extract/recover the contents (html,text) from the html that is generated by cheetah and delivered to the site viewer. to explain it further: during the output processing by cheetah placeholders are replaced with my text/html input. to edit/alter the page i have to extract my personal input out of the...
7
1615
by: Paul | last post by:
I have been coding apps with PHP for several years. But I am getting more involved in larger and more complicated PHP applications and want to use best practices. I use Eclipse's PHP IDE. I doubt I am using it to its full extent but I want to learn more about, and compare and contrast, frameworks versus IDE versus templating systems and MOST IMPORTANTLY learn what is going to save me time. I know technically the IDE is the tool in...
1
3071
by: brianrpsgt1 | last post by:
Newbie here.... I have been able to successful pull info from a MySQL DB, get the results and output them in an HTML format using Cheetah to the screen using IDLE. I am doing this on a Windows Laptop, running WinXP, Python 2.5 and the latest version of Cheetah. I have two questions: 1. How and where do you compile Cheetah templates in Windows? The command in the docs is cheetah compile a, however, I believe that this
6
3180
by: John Salerno | last post by:
I always have the desire to learn one thing well instead of split my attention between several options, so I'm trying to decide which of these two to start learning. Are there any particular things I should look at when deciding between them, in terms of features, for example? Do they do all the same things? Thanks.
0
7899
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8392
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8050
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8264
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6718
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5438
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3939
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2412
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1504
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.