Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
I want to use cheetah with cherryPy. To make things easier I created a helper that searches existing templates creates a instance of the cheetah Template class and returns it.
Then I want to be able to add data to the searchList. But I couldn't find any method that allows me to add new data to the searchList.
The only solution for me was to get a reference of the searchList and append my data there. But I don't think that this is the right way to do it.
This is basically what i do:
#return the template
def get_template(self, template):
self.current_template = template + self.FILE_EXTENSION
if (os.path.isfile(os.path.join(self.base_dir, self.current_template))):
tmpl = Template(file = os.path.join(self.base_dir, self.current_template))
# returns the template instance
tmpl = cherrypy.engine.publish("lookup-template", template).pop()
#get the searchList
searchlist = tmpl.searchList()
#add the data to the searchList
#set the response body
cherrypy.response.body = str(tmpl)