def start_with_layout(url, method="post", multipart=False, table_class=None, **attrs): """\ Start a form the way you would with ``start_form()`` but include the HTML necessary for the use of the ``fields()`` helper. >>> start_with_layout('/action', method='post') literal(u'<form action="/action" method="post"><table>') >>> start_with_layout('/action', method='post', table_class='form') literal(u'<form action="/action" method="post"><table class="form">') """ if table_class: return start_form(url, method, multipart, **attrs)+HTML.table( _closed=False, class_=table_class, ) else: return start_form(url, method, multipart, **attrs)+literal('<table>')
def form_start(*k, **p): """\ Start a form the way you would with ``start_form()`` but include the HTML necessary for the use of the ``fields()`` helper. >>> form_start('/action', method='post') literal(u'<form action="/action" method="post"><table>') >>> form_start('/action', method='post', table_class='form') literal(u'<form action="/action" method="post"><table class="form">') """ if p.has_key('table_class'): table_class = p.get('table_class', 'form') del p['table_class'] return start_form(*k,**p) + HTML.table( _closed=False, class_=p.get('table_class', 'form'), ) else: return start_form(*k,**p) + HTML.table(_closed=False)