--- a/web/test/unittest_reledit.py Fri Oct 22 16:02:05 2010 +0200
+++ b/web/test/unittest_reledit.py Fri Oct 22 17:10:31 2010 +0200
@@ -43,7 +43,8 @@
if rschema not in reledit:
continue
rtype = rschema.type
- self.assertMultiLineEqual(reledit[rtype] % {'eid': self.proj.eid}, self.proj.view('reledit', rtype=rtype, role=role), rtype)
+ self.assertMultiLineEqual(reledit[rtype] % {'eid': self.proj.eid},
+ self.proj.view('reledit', rtype=rtype, role=role), rtype)
def test_default_forms(self):
doreledit = {'title': """<div id="title-subject-%(eid)s-reledit" onmouseout="jQuery('#title-subject-%(eid)s').addClass('hidden')" onmouseover="jQuery('#title-subject-%(eid)s').removeClass('hidden')" class="releditField"><div id="title-subject-%(eid)s-value" class="editableFieldValue">cubicweb-world-domination</div><form action="http://testing.fr/cubicweb/validateform?__onsuccess=window.parent.cw.reledit.onSuccess" method="post" enctype="application/x-www-form-urlencoded" id="title-subject-%(eid)s-form" onsubmit="return freezeFormButtons('title-subject-%(eid)s-form');" class="releditForm" cubicweb:target="eformframe">
@@ -65,18 +66,14 @@
<fieldset class="default">
<table class="">
<tr class="title_subject_row">
-<td
->
+<td>
<input id="title-subject:%(eid)s" maxlength="32" name="title-subject:%(eid)s" size="32" tabindex="1" type="text" value="cubicweb-world-domination" />
</td></tr>
</table></fieldset>
<table class="buttonbar">
<tr>
-
<td><button class="validateButton" tabindex="2" type="submit" value="button_ok"><img alt="OK_ICON" src="http://testing.fr/cubicweb/data/ok.png" />button_ok</button></td>
-
<td><button class="validateButton" onclick="cw.reledit.cleanupAfterCancel('title-subject-%(eid)s')" tabindex="3" type="button" value="button_cancel"><img alt="CANCEL_ICON" src="http://testing.fr/cubicweb/data/cancel.png" />button_cancel</button></td>
-
</tr></table>
</fieldset>
</form><div id="title-subject-%(eid)s" class="editableField hidden"><div id="title-subject-%(eid)s-update" class="editableField" onclick="cw.reledit.loadInlineEditionForm('base', %(eid)s, 'title', 'subject', 'title-subject-%(eid)s', false, '');" title="click to edit this field"><img title="click to edit this field" src="data/pen_icon.png" alt="click to edit this field"/></div></div></div>""",
@@ -103,30 +100,24 @@
<table class="attributeForm">
<tr class="title_subject_row">
<th class="labelCol"><label class="required" for="title-subject:A">title</label></th>
-<td
->
+<td>
<input id="title-subject:A" maxlength="50" name="title-subject:A" size="45" tabindex="4" type="text" value="" />
</td></tr>
<tr class="description_subject_row">
<th class="labelCol"><label for="description-subject:A">description</label></th>
-<td
->
+<td>
<input name="description_format-subject:A" type="hidden" value="text/html" /><textarea cols="80" cubicweb:type="wysiwyg" id="description-subject:A" name="description-subject:A" onkeyup="autogrow(this)" rows="2" tabindex="5"></textarea>
</td></tr>
<tr class="rss_url_subject_row">
<th class="labelCol"><label for="rss_url-subject:A">rss_url</label></th>
-<td
->
+<td>
<input id="rss_url-subject:A" maxlength="128" name="rss_url-subject:A" size="45" tabindex="6" type="text" value="" />
</td></tr>
</table></fieldset>
<table class="buttonbar">
<tr>
-
<td><button class="validateButton" tabindex="7" type="submit" value="button_ok"><img alt="OK_ICON" src="http://testing.fr/cubicweb/data/ok.png" />button_ok</button></td>
-
<td><button class="validateButton" onclick="cw.reledit.cleanupAfterCancel('long_desc-subject-%(eid)s')" tabindex="8" type="button" value="button_cancel"><img alt="CANCEL_ICON" src="http://testing.fr/cubicweb/data/cancel.png" />button_cancel</button></td>
-
</tr></table>
</fieldset>
</form><div id="long_desc-subject-%(eid)s" class="editableField hidden"><div id="long_desc-subject-%(eid)s-add" class="editableField" onclick="cw.reledit.loadInlineEditionForm('edition', %(eid)s, 'long_desc', 'subject', 'long_desc-subject-%(eid)s', false, 'autolimited');" title="click to add a value"><img title="click to add a value" src="data/plus.png" alt="click to add a value"/></div></div></div>""",
@@ -152,8 +143,7 @@
<fieldset class="default">
<table class="">
<tr class="manager_subject_row">
-<td
->
+<td>
<select id="manager-subject:%(eid)s" name="manager-subject:%(eid)s" size="1" tabindex="9">
<option value="__cubicweb_internal_field__"></option>
<option value="%(toto)s">Toto</option>
@@ -162,11 +152,8 @@
</table></fieldset>
<table class="buttonbar">
<tr>
-
<td><button class="validateButton" tabindex="10" type="submit" value="button_ok"><img alt="OK_ICON" src="http://testing.fr/cubicweb/data/ok.png" />button_ok</button></td>
-
<td><button class="validateButton" onclick="cw.reledit.cleanupAfterCancel('manager-subject-%(eid)s')" tabindex="11" type="button" value="button_cancel"><img alt="CANCEL_ICON" src="http://testing.fr/cubicweb/data/cancel.png" />button_cancel</button></td>
-
</tr></table>
</fieldset>
</form><div id="manager-subject-%(eid)s" class="editableField hidden"><div id="manager-subject-%(eid)s-update" class="editableField" onclick="cw.reledit.loadInlineEditionForm('base', %(eid)s, 'manager', 'subject', 'manager-subject-%(eid)s', false, 'autolimited');" title="click to edit this field"><img title="click to edit this field" src="data/pen_icon.png" alt="click to edit this field"/></div></div></div>""",
--- a/web/views/formrenderers.py Fri Oct 22 16:02:05 2010 +0200
+++ b/web/views/formrenderers.py Fri Oct 22 17:10:31 2010 +0200
@@ -114,10 +114,10 @@
_w(self.open_form(form, values))
if self.display_progress_div:
_w(u'<div id="progress">%s</div>' % self._cw._('validating...'))
- _w(u'<fieldset>')
+ _w(u'\n<fieldset>\n')
self.render_fields(_w, form, values)
self.render_buttons(_w, form)
- _w(u'</fieldset>')
+ _w(u'\n</fieldset>\n')
_w(self.close_form(form, values))
errormsg = self.error_message(form)
if errormsg:
@@ -221,6 +221,7 @@
for field in form.fields:
if not field.is_visible():
w(field.render(form, self))
+ w('\n')
fields.remove(field)
return fields
@@ -238,28 +239,29 @@
except KeyError:
self.warning('no such fieldset: %s (%s)', fieldset, form)
continue
- w(u'<fieldset class="%s">' % (fieldset or u'default'))
+ w(u'<fieldset class="%s">\n' % (fieldset or u'default'))
if fieldset:
w(u'<legend>%s</legend>' % self._cw._(fieldset))
- w(u'<table class="%s">' % self.table_class)
+ w(u'<table class="%s">\n' % self.table_class)
for field in fields:
- w(u'<tr class="%s_%s_row">' % (field.name, field.role))
+ w(u'<tr class="%s_%s_row">\n' % (field.name, field.role))
if self.display_label and field.label is not None:
- w(u'<th class="labelCol">%s</th>' % self.render_label(form, field))
+ w(u'<th class="labelCol">%s</th>\n' % self.render_label(form, field))
w(u'<td')
if field.label is None:
w(u' colspan="2"')
error = form.field_error(field)
if error:
w(u' class="error"')
- w(u'>')
+ w(u'>\n')
w(field.render(form, self))
+ w('\n')
if error:
self.render_error(w, error)
if self.display_help:
w(self.render_help(form, field))
- w(u'</td></tr>')
- w(u'</table></fieldset>')
+ w(u'</td></tr>\n')
+ w(u'</table></fieldset>\n')
if byfieldset:
self.warning('unused fieldsets: %s', ', '.join(byfieldset))