Edgewall Software

Ticket #49 (closed defect: fixed)

Opened 8 years ago

Last modified 5 years ago

Lazy py:match

Reported by: waldemar.osuch@… Owned by: cmlenz
Priority: major Milestone: 0.3
Component: Template processing Version: 0.2
Keywords: Cc:

Description

When using the recipe  http://markup.edgewall.org/wiki/MarkupRecipes/FormFilling the form stops to be autofilled after three inputs. Got tired? :)

from markup.template import Template

src="""
<html xmlns:py="http://markup.edgewall.org/">

<input py:match="form//input" py:attrs="select('@*')" value="${form[str(select('@name'))]}" />

<body>
    <form action="" method="POST">
    <table>
        <tr py:for="fn in sorted(form)">
            <td py:content="fn.capitalize()">Label:</td><td><input type="text" name="${fn}"/></td>
        </tr>
    </table>
    <input type="submit" value="Save"/>
  </form>
</body>
</html>
"""

tmpl = Template(src)
form = dict(('hello_%s' % i, i) for i in range(5))
print tmpl.generate(**dict(form=form)).render(method='html')

produces:

<html>
<body>
    <form action="" method="POST">
    <table>
        <tr>
            <td>Hello_0</td><td><input value="0" type="text" name="hello_0"></td>
        </tr><tr>
            <td>Hello_1</td><td><input value="1" type="text" name="hello_1"></td>
        </tr><tr>
            <td>Hello_2</td><td><input value="2" type="text" name="hello_2"></td>
        </tr><tr>
            <td>Hello_3</td><td><input type="text" name="hello_3"></td>
        </tr><tr>
            <td>Hello_4</td><td><input type="text" name="hello_4"></td>
        </tr>
    </table>
    <input type="submit" value="Save">
  </form>
</body>
</html>

Attachments

Change History

Changed 8 years ago by cmlenz

  • status changed from new to closed
  • resolution set to fixed

Thanks for the report! This should be fixed in [273].

Add/Change #49 (Lazy py:match)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.