CherryPy Project Download

Storm is the ORM from Canonical (makers of Debian.) Here is the simple implementation I have that utilizes CP 3.1 (Currently Beta) and Storms current trunk release.

For my connection setup, here is the code.

def connect_db(thread_index):
	database = create_database(cherrypy.config.get('storm.default.url'))
	cherrypy.thread_data.store = Store(database)
	
cherrypy.engine.subscribe('start_thread', connect_db)

Here is a sample method that uses genshi, storm etc:

@cherrypy.expose
	@template.output('index.html')
	def index(self, site_id=1):
		##site_data	= q.get_by(site_id=site_id)
		site = cherrypy.thread_data.store.find(Site, Site.site_id == 1).one()
		return template.render(site=site)

Hosted by WebFaction

Log in as guest/cherrypy to create/edit wiki pages