source: MILK/trunk/milk_server/milk_server/lib/atomutilities.py @ 4675

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/MILK/trunk/milk_server/milk_server/lib/atomutilities.py@4675
Revision 4675, 568 bytes checked in by cbyrom, 12 years ago (diff)

Extend renderer to use htmlfill to allow a dict of form values to be
specified to allow forms to get pre-populated.

Line 
1#
2# This is a collection of utilities for atoms controllers
3#
4import logging
5from milk_server.lib.base import *
6from formencode import htmlfill
7
8def savePageAndRender(pathInfo, template, **inputs):
9    logging.debug("Saving current page url (%s) - to keep track of atom editor state" %pathInfo)
10    session['currentEditor'] = pathInfo
11    session.save()
12    logging.debug("Now rendering current template (%s)" %template)
13    html = render("genshi", template)
14    for key, val in inputs.items():
15        inputs[key] = str(val)
16
17    return htmlfill.render(html, inputs)
Note: See TracBrowser for help on using the repository browser.