I just put in a big commit. Notes are on the commit, but I didn't want
to dump my driver/test script into the repo because it's a hack. I'm
posting it here so the kids at home can play along. Note that the
widgets are being built with validators and the data values shown are
due to a hard-coded provider.get(1) in render().
I'll probably be doing some more hacking throughout the weekend. Let
me know if I'm stepping on toes.
:::
from subViewDesigner import DummySubViewDesigner
from subview import SubView
from provider import DictProvider
import types
config = dict(
template = {'engine': 'genshi',
'root': 'templates',
'template': 'dummy',
'configs': {'genshi.search_path':'.',
'genshi.default_doctype':'html'}},
)
dp = DictProvider({1:[1,'x',1.3],2:[2,'y',2.3],3:[3,'z',3.3]},
[('a',types.IntType),('b',types.StringType),('c',types.FloatType)])
sv = SubView(dp)
dsvd = DummySubViewDesigner()
dsvd.run(sv,config)
print ''.join(sv.render())
config['template']['engine'] = 'kid'
dsvd.run(sv,config)
print ''.join(sv.render())
::: Produces :::
{'a': {'widget': TextField('a', children=[], **{'validator': <class
'formencode.validators.Int'>}), 'type': <type 'int'>, 'name': 'a',
'title': 'a'}, 'c': {'widget': TextField('c', children=[],
**{'validator': <class 'formencode.validators.Number'>}), 'type':
<type 'float'>, 'name': 'c', 'title': 'c'}, 'b': {'widget':
TextField('b', children=[], **{}), 'type': <type 'str'>, 'name': 'b',
'title': 'b'}}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>DBMechanic Test -- For Genshi</title>
</head>
<body>
<ul>
<li>a</li><li>b</li><li>c</li>
</ul>
<form action="" method="post" class="listform">
<div>
</div>
<ul class="field_list">
<li class="even">
<label id="a.label" for="a" class="fieldlabel">A</label>
<input type="text" name="a" class="textfield" id="a">
</li><li class="odd">
<label id="b.label" for="b" class="fieldlabel">B</label>
<input type="text" name="b" class="textfield" id="b">
</li><li class="even">
<label id="c.label" for="c" class="fieldlabel">C</label>
<input type="text" name="c" class="textfield" id="c">
</li><li class="odd">
<input type="submit" class="submitbutton" value="Submit">
</li>
</ul>
</form>
</body>
</html>
{'a': {'widget': TextField('a', children=[], **{'validator': <class
'formencode.validators.Int'>}), 'type': <type 'int'>, 'name': 'a',
'title': 'a'}, 'c': {'widget': TextField('c', children=[],
**{'validator': <class 'formencode.validators.Number'>}), 'type':
<type 'float'>, 'name': 'c', 'title': 'c'}, 'b': {'widget':
TextField('b', children=[], **{}), 'type': <type 'str'>, 'name': 'b',
'title': 'b'}}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<title>DBMechanic Test -- For Kid!</title>
</head>
<body>
<table>
<tr><th>a</th><th>b</th><th>c</th>test</tr>
<form action="" method="post" class="listform">
<div>
</div>
<ul class="field_list">
<li class="even">
<label id="a.label" for="a" class="fieldlabel">A</label>
<input type="text" class="textfield" name="a" id="a">
</li><li class="odd">
<label id="b.label" for="b" class="fieldlabel">B</label>
<input type="text" class="textfield" name="b" id="b">
</li><li class="even">
<label id="c.label" for="c" class="fieldlabel">C</label>
<input type="text" class="textfield" name="c" id="c">
</li><li class="odd">
<input type="submit" class="submitbutton" value="Submit">
</li>
</ul>
</form>
</table>
</body>
</html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---