From 58c54609df8678e2fd963e08108a0845742fe7fb Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Tue, 15 May 2012 20:16:39 +0000 Subject: [PATCH] Extension to render to rename id svn: r19529 --- src/webapp/utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/webapp/utils.py b/src/webapp/utils.py index b96d71eb0..3bd521813 100644 --- a/src/webapp/utils.py +++ b/src/webapp/utils.py @@ -599,7 +599,8 @@ def display_date(obj): else: return "" -def render(formfield, user, action, test=False, truetext=""): +def render(formfield, user, action, test=False, truetext="", id=None): + #import pdb; pdb.set_trace() if not user.is_authenticated(): action = "view" if action == "view": @@ -610,13 +611,16 @@ def render(formfield, user, action, test=False, truetext=""): except: # name, "prefix" try: - retval = str(getattr(formfield.form, fieldname)) # formfield._data() + retval = str(formfield.form.data[fieldname]) # formfield._data() except: retval = "XXX" else: retval = truetext else: - retval = formfield.as_widget() + if id != None: + retval = formfield.as_widget(attrs={"id": id}) + else: + retval = formfield.as_widget() return retval def render_name(name, user):