Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #655 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

Forms no longer honour action= in display method

Reported by: xentac Owned by: anonymous
Priority: high Milestone:
Component: TG Widgets Version:
Severity: critical Keywords:


I'm not sure when this broke, but apparently, form.display(action='something') doesn't use that action.

The reason is the order of assignment in Widget.display. Our custom action is set in template_vars when display is called and then reset because around line 235 inside the update_data function.

I have an updated test to check the output, but I'm not sure how we want to go about fixing this. I've always thought that things passed in to the display method should override anything set directly on the widget.


form_test.patch Download (483 bytes) - added by xentac 13 years ago.

Change History

Changed 13 years ago by xentac

comment:1 Changed 13 years ago by michele

Hi Jason,

I've tried your test on my local installation and all is working fine.

michele@ionic:~/Progetti/TurboGears/svn/turbogears/widgets$ nosetests
Ran 61 tests in 2.512s

michele@ionic:~/Progetti/TurboGears/svn/turbogears/widgets$ svn diff
Index: tests/test_forms.py
--- tests/test_forms.py (revision 918)
+++ tests/test_forms.py (working copy)
@@ -25,6 +25,7 @@
     assert "Your Name" in output
     assert 'NAME="name"' in output
     assert "submit" in output
+    assert "mylocation" in output

 def test_input_conversion():
     "Input for the whole form can be validated and converted"


>>> p = TableForm(name="test", fields=[TextField(name="hello")])
>>> p.render()
'<FORM ACTION="" NAME="test" METHOD="post">\n        \n        <TABLE BORDER="0" >\n            <TR>\n                <TD>\n                    <LABEL CLASS="fie ldlabel" FOR="hello">Hello</LABEL>\n                </TD>\n                <TD>\ n                    <INPUT CLASS="textfield" TYPE="text" ID="hello" NAME="hello ">\n                    \n                    \n                    \n       </TD>\n            </TR>\n            <TR>\n                <TD>\xc2\xa0</ TD>\n                <TD>\n                <INPUT TYPE="submit" CLASS="submitbut ton">\n                \n                </TD>\n            </TR>\n        </TAB LE>\n    </FORM>'
>>> p.render(action="save")
'<FORM ACTION="save" NAME="test" METHOD="post">\n        \n        <TABLE BORDER="0">\n            <TR>\n                <TD>\n                    <LABEL CLASS="fieldlabel" FOR="hello">Hello</LABEL>\n                </TD>\n                <TD>\n                    <INPUT CLASS="textfield" TYPE="text" ID="hello" NAME="hello">\n                    \n                    \n                    \n                </TD>\n            </TR>\n            <TR>\n                <TD>\xc2\xa0</TD>\n                <TD>\n                <INPUT TYPE="submit" CLASS="submitbutton">\n                \n                </TD>\n            </TR>\n        </TABLE>\n    </FORM>'

that's strange... :-/

comment:2 Changed 13 years ago by xentac

It's very strange. svn diff tells me about a couple patches that definitely don't affect this test. And svn update tells me everything's new.

comment:3 Changed 13 years ago by xentac

svn update being at revision 918.

comment:4 Changed 13 years ago by michele

  • Status changed from new to closed
  • Resolution set to fixed

xentac reported on the group that this is working right. ;)

Note: See TracTickets for help on using tickets.