Skip to content

Instantly share code, notes, and snippets.

@emilepetrone
Created August 22, 2010 18:16
Show Gist options
  • Save emilepetrone/544091 to your computer and use it in GitHub Desktop.
Save emilepetrone/544091 to your computer and use it in GitHub Desktop.
def doRender(handler, tname='base/index.html', values={}):
temp = os.path.join(
os.path.dirname(__file__),
'templates/' + tname)
if not os.path.isfile(temp):
return False
#Make a copy of the dictionary
newval = dict(values)
newval['path'] = handler.request.path
handler.session = Session()
if 'username' in handler.session:
newval['username'] = handler.session['username']
outstr = template.render(temp, newval)
handler.response.out.write(outstr)
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment