I know this might be heresy, but what about using FormEncode?
While discussing the workflow ticket validation, Chris suggested that it
would be good to have form validation across all Trac forms. This of
course would be a much bigger job than just what I had planned, but
using FormEncode would pretty much solve that problem. It would also
fulfill the requirements of this thread:
1> from formencode.htmlgen import html
2> html.table(
html.tr(
html.td()("FOO")
),
html.tr(
html.td()("BAH")
)
)
<2 <table><tr><td>FOO</td></tr><tr><td>BAH</td></tr></table>
The syntax is quite clean I think, and similar to Chris' library.
It also has a few other features which could be quite useful.
I know it introduces dependencies, but it's got some pretty useful
features, and reinventing the wheel, while it can be fun, isn't
necessarily the best route in all situations. And last but not least, it
can't be any harder to install than ClearSilver currently is :)
On Fri, Mar 10, 2006 at 02:05:09PM +0100, Christian Boos wrote:
> Christian Boos wrote:
> >...
> >A few suggestions:
> >* add an easy way to add list of nodes.
> > Fragment.__get_item__ should accept iterable,
> > as in the example below (TBODY(rows))
>
> I've just realized there's an easy alternative:
> >1) excerpt of TracIni macro which creates an HTML table:
> > ...
> > rows = []
> tbody = TBODY()
> > for section, configs, section_doc in default_config:
> > ...
> > row = TR()[TH(rowspan=nconfigs*2)[section]]
> > for name, value, since, doc in configs:
> > ...
> > html_doc = wiki_to_html(doc, self.env, req)
> > row.append(TD(class_="name")[name])
> > row.append(TD(class_="defaultvalue")[value])
> > rows.append(row)
> > rows.append(TR()[TD(colspan="2", class_="doc")[html_doc]])
> tbody.append() instead of rows.append()
> > row = TR()
> > if not rows:
> if not tbody.children:
> > return ''
> > add_stylesheet(req, 'common/css/about.css')
> > return str(DIV(class_="about_config")[
> > TABLE()[THEAD()[TR()[TH(class_="section")["Section"],
> > TH(class_="name")["Name"],
> > TH(class_="defaultvalue")["Default
> >Value"]]],
> > TBODY()[rows]]])
> tbody]])
>
>
>
> -- Christian
> _______________________________________________
> Trac-dev mailing list
> [email protected]
> http://lists.edgewall.com/mailman/listinfo/trac-dev
>
--
Evolution: Taking care of those too stupid to take care of themselves.
_______________________________________________
Trac-dev mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-dev