actions='#', fixed issue 1253, thanks yaribaud
This commit is contained in:
2
VERSION
2
VERSION
@@ -1 +1 @@
|
||||
Version 2.4.1-alpha.2+timestamp.2013.01.08.11.35.00
|
||||
Version 2.4.1-alpha.2+timestamp.2013.01.08.14.36.21
|
||||
|
||||
@@ -991,7 +991,7 @@ class DIV(XmlComponent):
|
||||
>>> a=FORM( INPUT(_type='text'), SELECT(range(1)), TEXTAREA() )
|
||||
>>> for c in a.elements('input, select, textarea'): c['_disabled'] = 'disabled'
|
||||
>>> a.xml()
|
||||
'<form action="" enctype="multipart/form-data" method="post"><input disabled="disabled" type="text" /><select disabled="disabled"><option value="0">0</option></select><textarea cols="40" disabled="disabled" rows="10"></textarea></form>'
|
||||
'<form action="#" enctype="multipart/form-data" method="post"><input disabled="disabled" type="text" /><select disabled="disabled"><option value="0">0</option></select><textarea cols="40" disabled="disabled" rows="10"></textarea></form>'
|
||||
|
||||
Elements that are matched can also be replaced or removed by specifying
|
||||
a "replace" argument (note, a list of the original matching elements
|
||||
@@ -1932,7 +1932,7 @@ class FORM(DIV):
|
||||
>>> from validators import IS_NOT_EMPTY
|
||||
>>> form=FORM(INPUT(_name=\"test\", requires=IS_NOT_EMPTY()))
|
||||
>>> form.xml()
|
||||
'<form action=\"\" enctype=\"multipart/form-data\" method=\"post\"><input name=\"test\" type=\"text\" /></form>'
|
||||
'<form action=\"#\" enctype=\"multipart/form-data\" method=\"post\"><input name=\"test\" type=\"text\" /></form>'
|
||||
|
||||
a FORM is container for INPUT, TEXTAREA, SELECT and other helpers
|
||||
|
||||
@@ -2033,7 +2033,7 @@ class FORM(DIV):
|
||||
|
||||
def _postprocessing(self):
|
||||
if not '_action' in self.attributes:
|
||||
self['_action'] = ''
|
||||
self['_action'] = '#'
|
||||
if not '_method' in self.attributes:
|
||||
self['_method'] = 'post'
|
||||
if not '_enctype' in self.attributes:
|
||||
@@ -2415,25 +2415,25 @@ def test():
|
||||
<table><tr><td>a</td><td>b</td><td>c</td></tr><tr><td>d</td><td>e</td><td>f</td></tr><tr><td>1</td><td>2</td><td>3</td></tr></table>
|
||||
>>> form=FORM(INPUT(_type='text', _name='myvar', requires=IS_EXPR('int(value)<10')))
|
||||
>>> print form.xml()
|
||||
<form action=\"\" enctype=\"multipart/form-data\" method=\"post\"><input name=\"myvar\" type=\"text\" /></form>
|
||||
<form action=\"#\" enctype=\"multipart/form-data\" method=\"post\"><input name=\"myvar\" type=\"text\" /></form>
|
||||
>>> print form.accepts({'myvar':'34'}, formname=None)
|
||||
False
|
||||
>>> print form.xml()
|
||||
<form action="" enctype="multipart/form-data" method="post"><input class="invalidinput" name="myvar" type="text" value="34" /><div class="error_wrapper"><div class="error" id="myvar__error">invalid expression</div></div></form>
|
||||
<form action="#" enctype="multipart/form-data" method="post"><input class="invalidinput" name="myvar" type="text" value="34" /><div class="error_wrapper"><div class="error" id="myvar__error">invalid expression</div></div></form>
|
||||
>>> print form.accepts({'myvar':'4'}, formname=None, keepvalues=True)
|
||||
True
|
||||
>>> print form.xml()
|
||||
<form action=\"\" enctype=\"multipart/form-data\" method=\"post\"><input name=\"myvar\" type=\"text\" value=\"4\" /></form>
|
||||
<form action=\"#\" enctype=\"multipart/form-data\" method=\"post\"><input name=\"myvar\" type=\"text\" value=\"4\" /></form>
|
||||
>>> form=FORM(SELECT('cat', 'dog', _name='myvar'))
|
||||
>>> print form.accepts({'myvar':'dog'}, formname=None, keepvalues=True)
|
||||
True
|
||||
>>> print form.xml()
|
||||
<form action=\"\" enctype=\"multipart/form-data\" method=\"post\"><select name=\"myvar\"><option value=\"cat\">cat</option><option selected=\"selected\" value=\"dog\">dog</option></select></form>
|
||||
<form action=\"#\" enctype=\"multipart/form-data\" method=\"post\"><select name=\"myvar\"><option value=\"cat\">cat</option><option selected=\"selected\" value=\"dog\">dog</option></select></form>
|
||||
>>> form=FORM(INPUT(_type='text', _name='myvar', requires=IS_MATCH('^\w+$', 'only alphanumeric!')))
|
||||
>>> print form.accepts({'myvar':'as df'}, formname=None)
|
||||
False
|
||||
>>> print form.xml()
|
||||
<form action="" enctype="multipart/form-data" method="post"><input class="invalidinput" name="myvar" type="text" value="as df" /><div class="error_wrapper"><div class="error" id="myvar__error">only alphanumeric!</div></div></form>
|
||||
<form action="#" enctype="multipart/form-data" method="post"><input class="invalidinput" name="myvar" type="text" value="as df" /><div class="error_wrapper"><div class="error" id="myvar__error">only alphanumeric!</div></div></form>
|
||||
>>> session={}
|
||||
>>> form=FORM(INPUT(value=\"Hello World\", _name=\"var\", requires=IS_MATCH('^\w+$')))
|
||||
>>> if form.accepts({}, session,formname=None): print 'passed'
|
||||
|
||||
@@ -1687,7 +1687,7 @@ SQLITE = set((
|
||||
))
|
||||
|
||||
|
||||
MONGODB_NONRESERVED = set(('ID_', 'SAFE',))
|
||||
MONGODB_NONRESERVED = set(('SAFE',))
|
||||
|
||||
# remove from here when you add a list.
|
||||
JDBCSQLITE = SQLITE
|
||||
|
||||
@@ -74,7 +74,7 @@ class TestBareHelpers(unittest.TestCase):
|
||||
|
||||
def testFORM(self):
|
||||
self.assertEqual(FORM('<>', _a='1', _b='2').xml(),
|
||||
'<form a="1" action="" b="2" enctype="multipart/form-data" method="post"><></form>')
|
||||
'<form a="1" action="#" b="2" enctype="multipart/form-data" method="post"><></form>')
|
||||
|
||||
def testH1(self):
|
||||
self.assertEqual(H1('<>', _a='1', _b='2').xml(),
|
||||
|
||||
Reference in New Issue
Block a user