Questions tagged [cheetah]

Cheetah3 is a free and open source (MIT) Python template engine. Works with Python 2.7 and 3.4+.

cheetah
Filter by
Sorted by
Tagged with
15 votes
2 answers
16k views

Python: format string with custom delimiters [duplicate]

EDITED I have to format a string with values from a dictionary but the string already contains curly brackets. E.g.: raw_string = """ DATABASE = { 'name': '{DB_NAME}' } """ But, of ...
Don's user avatar
  • 17.3k
7 votes
1 answer
8k views

HTML/CSS/JS Syntax Highlighting in Eclipse

Hello How can I enable syntax highlighting for HTML/CSS/JS in Eclipse I am mainly developing in python using the PyDev package but right now I am creating Cheetah templates and they are very hard to ...
BillPull's user avatar
  • 6,933
5 votes
1 answer
6k views

Using Cheetah Templating system with windows and python 2.6.1 (namemapper problem)

So I am trying to use the Cheetah templating engine in conjunction with the Django web framework, and that is actually working fine. I did some simple tests with that and I was able to render pages ...
Daniel Waltrip's user avatar
4 votes
1 answer
824 views

cheetah templating with flask

I can't seem to find any information about using the cheetah templating engine with flask. Can anyone point me to something that google can't find, or show me how to use cheetah templates in a simple ...
Hoopes's user avatar
  • 4,023
4 votes
2 answers
4k views

Python shared libraries - Cheetah namemapper.so not found

I'm using Python Cheetah for template generation and I can't get it to use the compiled _namemapper.so library that is installed. I am running on CentOS 5.4 with Python 2.4 installed, using Cheetah 2....
purecharger's user avatar
  • 1,253
3 votes
2 answers
124 views

AppEngine database model has has_key() method but is not iterable?

I am getting: argument of type 'Lantern' is not iterable in one of the template engine files (Cheetah). As you can guess the obj is a Lantern (see below). NameWrapper.py: if hasattr(obj, 'has_key') ...
kev's user avatar
  • 9,247
3 votes
1 answer
370 views

Automatic compilation of parent templates

I am trying to setup dynamic compilation of Cheetah templates, useful for development (so I don't have to recompile them with cheetah compile after each change). Seems like Cheetah.Template.Template ...
Roman Bodnarchuk's user avatar
3 votes
2 answers
1k views

Passing data from the cherrypy server-side to javascript client-side

Big picture question. I've got a cherrypy server running with all the shopping cart methods for my e-commerce site written in python. I'm working with jquery on the front end. POSTing to my python ...
colinmarc's user avatar
3 votes
0 answers
55 views

Can I use linting/fixing tools on a Cheetah template?

I’m trying to use prettier to fix Javascript/HTML code formatting. Unfortunately the final Javascript/HTML is generated from a Cheetah template, so there are many lines that start with # characters. ...
user2597451's user avatar
  • 1,903
3 votes
0 answers
310 views

Is there something like Qt Designer for the web on Linux?

I'm very used to using Qt Designer to design GUIs, and I would like to be able to use something similar on a Python project I'm working on that I'd like to create a web interface for, but I find that ...
supercheetah's user avatar
  • 3,220
3 votes
1 answer
1k views

Python Cheetah - Specify name/value pairs for templating

I am trying to template-ize my Apache httpd configuration for deployment to different environments and I would like to use the Python language Cheetah application to do so. However, I am having ...
purecharger's user avatar
  • 1,253
2 votes
1 answer
163 views

Easiest and fastest way to template, possibly in a PDF

I have been looking extensively for a simple solution to a not-very-complicated problem. I have a great deal of data in a sql database which needs to be printed (for example, each entry would have ...
floppyraid's user avatar
2 votes
1 answer
979 views

Problem in installing update cheetah==2.4.4

I'm trying to install updates from my requirements.txt: pip install -r requirements.txt but when the installing has arrived to cheetah it printed this error: I'm trying to run some updates require by ...
Moez Ben Rebah's user avatar
2 votes
2 answers
5k views

Cheetah package installation error -on python 3

Getting below error while installing Cheetah package (Cheetah-2.4.4) with python 3.4.3 Traceback (most recent call last): File "setup.py", line 10, in <module> import SetupTools ...
sanjay pujari's user avatar
2 votes
2 answers
2k views

CherryPy can't seem to find CSS script (static or absolute paths)

i'm using the cherryPy framework to serve my site, but it cannot seem to find my css script with either the static path or the absolute path. The css script works fine if i just go to the index.tmpl ...
Lex's user avatar
  • 386
2 votes
3 answers
212 views

Is there a way to get a list of all placeholders in a cheetah template

For example, if I have a template such as "SELECT * FROM myOrders WHERE order_id = ${orderId} and order_date = ${orderDate}" I would like to get a list of all placeholders in that template, i.e. ['...
victtim's user avatar
  • 810
2 votes
2 answers
603 views

Cheetah #include doesn't place #def within scope

When I include a file using #include (without raw) it parses the content correctly, but the #def which I want to access within the original file doesn't exist & an error is thrown. Base Template: ...
smokedice's user avatar
  • 970
2 votes
2 answers
2k views

Cheetah with Cherrypy: how to load base templates, and do so automatically on change during development

I am working on a cherrypy+cheetah app and would like to improve the development experience. I have everything working when I manually compile templates beforehand. (Update: This is how things work ...
Heikki Toivonen's user avatar
2 votes
2 answers
40 views

Looping through a collection has different behaviour if source has only one item with Python Cheetah3

I'm trying to write some code that will parse a collection/list/array etc and I had this working when the size is greater than 1. However when only 1 item is in the collection the code fails as the ...
Cynan's user avatar
  • 174
2 votes
1 answer
329 views

How should I access Cheetah Template() variable placeholders in an object instance?

I'm trying to set up an object instance that will provide values to the Cheetah3 text templating engine. This is my text template script... #filename: py_text_template.py from traits.api import ...
Mike Pennington's user avatar
2 votes
1 answer
821 views

cheetah template importing functions

So I am having some trouble trying to import functions and run them inside my cheetah templates. So I have one file that lives at /docroot/tmpl/base.html and then another file that is /docroot/tmpl/...
BillPull's user avatar
  • 6,933
2 votes
4 answers
7k views

Installing GNU Radio on ubuntu

Im trying to install GNU Radio, I need this to be able to install gqrx to use my software defined radio dongle. I have followed the guide at https://www.jeroennijhof.nl/wiki/index.php/Software-...
Karl's user avatar
  • 59
2 votes
0 answers
158 views

create a cheetah tool for cherrypy

I just started to play around with cherrypy and wanted to use cheetah as a templating engine. Therefore I wanted to create a tool so I just can use the annotation feature to point to my template ...
daniel's user avatar
  • 1,012
2 votes
0 answers
170 views

What would a Cheetah template binding for Pyramid look like?

I've found this topic, which talks about Pystache, and I've seen a few bindings on Github for other engines but I'm confused on how to get Cheetah to work with Pyramid. Any pointers or what the code ...
brandonjschwartz's user avatar
1 vote
4 answers
1k views

Cheetah template engine calling python base function

I am using Cheetah template together with Cherrypy, below is my main python file Main.py: def multiple(a,b): return a*b def index(self): t = Template('template.tmpl') #blah ...
drhanlau's user avatar
  • 2,527
1 vote
1 answer
1k views

installing cheetah in home directory [closed]

I am trying to install the Cheetah template engine in my home directory. I have a school website account and do not have root access. I changed my python path to the directory I am installing to, but ...
Peter's user avatar
  • 1,062
1 vote
3 answers
573 views

How do I truncate floats to two decimal places in cheetah templates?

I'm currently using Cheetah Templates with my python code and I'm passing in a number of floating point numbers. I'd like to truncate these floats to only two decimal places within the template, e.g. ...
Andrew Thompson's user avatar
1 vote
2 answers
58 views

Using a variable called 'request' in dictionary with Python Cheetah3

I've been experimenting with Cheetah3 as a templating engine to transform XML into something else. I have this working, using the below example XML input <?xml version="1.0" encoding=&...
Cynan's user avatar
  • 174
1 vote
1 answer
509 views

CherryPy with Cheetah as plugin + tool - blank pages

CherryPy keeps returning blank pages or with the values I return in the controllers. I rewrote a django and jinja2 version that did work, apparently this one doesn't which is almost identical to the ...
PvdL's user avatar
  • 1,584
1 vote
1 answer
83 views

In emacs how do I add a second type of commenting to a css derived mode?

I have a templating css file type that allows comments to start with '##' No matter what I try though It doesn't seem to recognize this in my derived-mode. Here is what i have so far (define-derived-...
telaviv's user avatar
  • 406
1 vote
1 answer
1k views

calling a function with cherry.py

So im doing a bit of web development, and due to some restriction set by my employer i need to use cheetah and cherrypy. I have this form that upon submit runs a function, and from said function i ...
Lex's user avatar
  • 386
1 vote
1 answer
577 views

variable nested templates in cheetah

i have a base template that calls a nested template based on a variable passed in, eg. page = 6 and what i want is to call some html as follows: ... <div> #include "templates/_page${page}....
khany's user avatar
  • 1,167
1 vote
1 answer
1k views

How can I properly use multidimensional dictionaries in Cheetah for Python?

I have the following dictionary: {0: {'Shortname': 'cabling', 'Name': 'CAT5 Cabling', 'MSRP': '$45.00'}, 1: {'Shortname': 'antenna', 'Name': 'Radio Antenna', 'MSRP': '$35.00'}} And using Cheetah, ...
Eamon's user avatar
  • 23
1 vote
2 answers
3k views

generating javascript string in python

i have string stored in python variables, and i am outputting a html that contains javascript, and the i need to create javascript variables. for ex, in python title = "What's your name?" i use ...
kevin's user avatar
  • 4,267
1 vote
1 answer
469 views

How to catch Cheetah NameMapper.NotFound exception?

I've a piece of code: #try: <a href="/organisations/details/?tag=$inv.customer.org.tag">$inv.customer.org.name</a> #except NameMapper....
Juha Tuomala's user avatar
1 vote
1 answer
257 views

How do I use inheritance in Cheetah templates?

For Cheetah3, there is a very rough documentation of the inheritance feature: http://cheetahtemplate.org/users_guide/inheritanceEtc.html#extends But I don't get how to make it actually work. Let's ...
nasezoll's user avatar
  • 101
1 vote
1 answer
454 views

How to render unicode characters in a Cheetah template?

I would like to render a variable with Unicode characters, using the Cheetah template engine. My template file template.txt looks like this: This is static text in the template: äöü This is filled ...
Nijin22's user avatar
  • 850
1 vote
1 answer
188 views

How can you add thousand separator when formatting a number in Cheetah?

I'm trying to format a number as a price in Cheetah3 (Python 3.6). While I have succeeded to limit to 2 decimals using the standard formatting expression, the comma separator doesn't seem to work (I ...
Geeho's user avatar
  • 210
1 vote
1 answer
177 views

syntax error with '$' sign ; Cheetah / bash

I work on a script running Cheetah ; at some point there are some bash commands and I got a syntax error ("Error in the Python code which Cheetah generated for this template"). The line involved is : ...
Micawber's user avatar
  • 707
1 vote
1 answer
214 views

Append to existing dictionary in Cheetah-based template

I'm trying to add my own custom lines into the Cobbler snippet as Cheetah code. I can create a dictionary using #set, but how do I append to the same dictionary down the line? ... #set partitions={ '...
Riz Lee's user avatar
  • 13
1 vote
1 answer
270 views

Python cheetah variables inside a #raw javascript block?

If I have a block of #raw that has javascript inside it and sometimes I need to access some python variables (the $foo in example case) from that javascript. #raw <script type="text/javascript" ...
Juha Tuomala's user avatar
1 vote
1 answer
614 views

Best method to replace iframes from an application

So I am rewriting the UI for an application that currently loads all the actual page content via iframes and just has a wrapper around it that contains a menu and some other information. My question ...
BillPull's user avatar
  • 6,933
1 vote
1 answer
3k views

Jinja variable not being set properly in for loop

I am having a variable scope issue in Jinja that is misaligning a table. I am trying to convert the current template that is written in Cheetah to Jinja but for some reason this block of logic does ...
BillPull's user avatar
  • 6,933
1 vote
1 answer
743 views

Cheetah template filters

Sorry if the question sounds naive. I have a cheetah template, e.g: #filter None <html> <body> $none should be '' $number should be '1' </body> </html> #end filter with ...
BPm's user avatar
  • 2,924
1 vote
1 answer
1k views

Check if Cheetah Template Dict has key

I am trying to come up with a base template for an application and one of the goals would be to remove any unnecessary js/css from pages so I want to do something in the cheetah template like #if $...
BillPull's user avatar
  • 6,933
1 vote
1 answer
997 views

Facing syntax error while running source venv.source on mac terminal

I am running "source venv.source" command in my Mac terminal inside a cloned repo from Github, can someone please help me. ========================================= Activating virtual environment ====...
Sai Krishna's user avatar
1 vote
1 answer
53 views

Static attributes in Cheetah

I'm working on a project using Cheetah. I'd like to create a class like the following one: from Cheetah.Template import Template class TemplateObject(Template): className = "Default ClassName" ...
Xatyrian's user avatar
  • 1,374
1 vote
0 answers
2k views

Cheetah requires Python module Cheetah 2.1.0 or newer - laucnhing sickbeard

I am trying to use sickbeard on a mac via terminal. I have installed the latest version pf python (homebrew), then installed cheetah (git then python setup.py install). when finally i try to: python ...
Freddy's user avatar
  • 15
1 vote
1 answer
1k views

Execute stored procedure when a button is clicked on python web

I am creating a webpage that displays a list of object that exist in a database/table. I have a stored procedure which retrieves the data from the table and associates with each column the data will ...
Benedict Lee's user avatar
1 vote
2 answers
159 views

Getting python Cheetah to print backslash

I am having trouble getting the Python Cheetah to print a backslash for me. Cheetah version 2.4.4 from Cheetah.Template import Template my_template = """ Stuff $var1\\$var2 """ t = Template(source=...
Kannan Ekanath's user avatar