Questions tagged [cheetah]

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

Filter by
Sorted by
Tagged with
2 votes
2 answers
38 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
  • 172
1 vote
2 answers
45 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
  • 172
0 votes
0 answers
35 views

How to configure Cheetah on Django

Is there a tutorial on how to configure Django and cheetah to print out simple text like hello world in variables or lists? I'm trying to configure cheetah with Django or find instructions on how to ...
Nikos Chalevas's user avatar
2 votes
1 answer
296 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
-1 votes
1 answer
73 views

How to dynamically build a Cheetah3 placeholder variable name?

The bash shell lets you do this with ${!variablename}. This will retrieve the bash variable whose name is contained within the variable named 'variablename'. I'm looking for a way to do that same ...
Joel Bion's user avatar
3 votes
0 answers
54 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
2 votes
1 answer
867 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
1 vote
1 answer
961 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
0 votes
1 answer
207 views

How to multiply two parameters in a gnuradio-companion xml file

I have to user set parameters in the grc gui and I need to multiply them to set the output vector length of my block. I cannot figure out how to do this in the grc xml file. I have tried looking at ...
Aaron Lutzker's user avatar
1 vote
1 answer
447 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
246 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
436 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
154 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
51 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,364
1 vote
1 answer
172 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
0 votes
1 answer
317 views

Assign a bash command result in a Cheetah variable

I'm currently trying to put the result of a bash command into a Cheetah variable : #set $name = #echo '$input.element_identifier' + ".phy" | cut -d _ -f 1 '$input.element_identifier' Being (sort of) ...
Micawber's user avatar
  • 707
1 vote
1 answer
208 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
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
0 votes
1 answer
923 views

using template engine to generate code (text)

I have bunch of YAML files in a config folder and bunch of templates in a template folder. The use case I have is to generate text file based on the yaml config and templates. I want to see if python ...
pmv's user avatar
  • 349
1 vote
1 answer
259 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
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
3 answers
199 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
  • 800
14 votes
2 answers
15k 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
  • 17k
0 votes
0 answers
32 views

exporting texture from blender to cheetah 3d?

i would like to export a texture from blender software to cheetah 3d software. Anyone knows a way to do it ? for now the only way i found it is to export complete model on .obj
Makamik's user avatar
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
3 answers
567 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
3 votes
2 answers
123 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,077
1 vote
1 answer
499 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,578
0 votes
1 answer
1k views

Custom templates in python

I am trying to implement custom template formatting in python accomplishing two things Django like delimiter {{ placeholder }} eg. from string import Template class MyTemplate(Template): ...
userx's user avatar
  • 836
1 vote
2 answers
143 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
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
0 votes
1 answer
108 views

Difference between automatic programming and compiling

CheetahTemplate allows source code generation, how is this different from a compiler generated through something like ANTLR?
Mike Vella's user avatar
  • 10.3k
0 votes
1 answer
193 views

karrigell import my own module

i'm new in karrigell, but i got problem when i was trying to use the phase from testmodule import TestClass where the "testmodule" is my own module and TestClass is the only class defined inside ...
fly's user avatar
  • 11
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
0 votes
1 answer
121 views

Upgrading Cheetah Templates and Getting Odd Errors in Variable Assignment

I am attempting to upgrade Cheetah in a work project from 0.9 to 2.4.4. I'm getting some odd errors when creating certain variables inside templates. Below is an example: #set formUtil = $iLib....
Botono's user avatar
  • 65
1 vote
1 answer
289 views

Cheetah installing error

I'm trying to install on my machine gnuradio and to do so I have to install another programs, according to this site. Everything goes well but when I have to install the cheetah dependency it gives me ...
user2262302's user avatar
2 votes
0 answers
155 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
169 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
0 votes
1 answer
767 views

Cheetah #include not working

#include doesn't seem to be working, I get a "500 Internal Server Error". I tried the same code without the include, putting all the code in one file, and it works. i'm using the web framwork Flask ...
Lex's user avatar
  • 386
3 votes
0 answers
280 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,200
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
2 votes
1 answer
162 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
1 vote
1 answer
176 views

How to substitue better in Cheetah templates

Given the following Cheetah template #filter None {data:[ #for $person in $persons {naam: "#if $person.lastname==None then '' else $person.lastname.replace('"', '\\"')#}, #end for ]} #end filter ...
Paul's user avatar
  • 1,068
0 votes
1 answer
301 views

Iterating over python list only gives each letter

I have a list.. availablethemes = ['cerulean', 'default', 'journal', 'united'] And I'm trying to put each item in a dropdown item list <select id="theme" name="theme"> #for $interface in $...
Michael Esteves's user avatar
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
612 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,913
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,913
3 votes
1 answer
369 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
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
728 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