473,574 Members | 17,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compile Cheetah Template on Windows

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
is for Linux. This does nothing in a DOS Prompt. Please provide the
info for this command in Windows.

2. How do I output the HTML to a file? I tried the following:

FILE = open(filename, "wt")
FILE.writelines (output)
FILE.close()

I get an error though that states that writelines() requires an
interable argument

Thnx for any assistance!

B

Nov 24 '07 #1
1 3070
brianrpsgt1 <br*******@cox. netwrote:
>
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
is for Linux. This does nothing in a DOS Prompt. Please provide the
info for this command in Windows.
The Cheetah installation should have created scripts called "cheetah" and
"cheetah-compile" in your Python25\Script s directory. The issue you have
is that they aren't on your path.

One answer is to copy Python25\Script s\cheetah to \Windows\cheeta h.py and
Python25\Script s\cheetah-compile to \Windows\cheeta h-compile.py. Then you
can type "cheetah.py compile xxx" or "cheetah-compile.py xxx".

However, you don't have to compile them in advance. You can do "from
Cheetah.Templat e import Template" and compile them on the fly, with
tmpl = Template( file='page.tmpl ' )
>2. How do I output the HTML to a file? I tried the following:

FILE = open(filename, "wt")
FILE.writeline s(output)
FILE.close()

I get an error though that states that writelines() requires an
interable argument
Just use FILE.write( output ).
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Nov 26 '07 #2

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

Similar topics

1
2398
by: Mike Grigorov | last post by:
I am using cheetah with jython 2.1 and I have problem generating templates that contain cyrillic text. Some texts are printed OK and others are not. I searched Jython and cheetah projects mailing lists on sourceforge.net as well as these groups and tried some other fixes proposed but without success. I call the template like this: ...
0
1266
by: Thomas | last post by:
Hi, i have a webserver with (approx.) the code below, but whatever i do the html code sent to the browser stays the same. The strangest is, if i insert a local variable in the class which is incremented upon each call to self.render_GET() and append it to the html code, it increments correctly on the browser. Could it be a probem with...
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...
3
1436
by: wolfgang.lipp | last post by:
hi, yesterday i started with web.py / flup / cheetah, and managed to get a first webpage to diaplay on my windows box running apache. unfortunately, the following code import web urls = (
0
913
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. =====================
1
1385
by: chun ping wang | last post by:
I am having trouble using cheetah and getting it to work the way i want (mvc) I have the following file. index.py : # imports BibleController and setting. BibleController.py that includes the Bible.py model to database (those works). At the end of it i have.
4
1349
by: Paolo Pantaleo | last post by:
I have a cheetah template something like this: x is: $x y is: $y z is: $z If for example $y is not defined I get an exception and the parsing of the template stops. Is there any way to substitute $y with an emty
2
1367
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...
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...
0
7820
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8258
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8121
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...
0
6486
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...
1
5635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5325
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...
1
2255
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
1360
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1084
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.