diff -r 495862266785 -r 6b46d73823f5 web/formwidgets.py
--- a/web/formwidgets.py Wed Sep 23 19:26:38 2009 +0200
+++ b/web/formwidgets.py Wed Sep 23 19:40:19 2009 +0200
@@ -39,9 +39,9 @@
def add_media(self, form):
"""adds media (CSS & JS) required by this widget"""
if self.needs_js:
- form.req.add_js(self.needs_js)
+ form._cw.add_js(self.needs_js)
if self.needs_css:
- form.req.add_css(self.needs_css)
+ form._cw.add_css(self.needs_css)
def render(self, form, field, renderer):
"""render the widget for the given `field` of `form`.
@@ -60,12 +60,12 @@
if self.setdomid:
attrs['id'] = form.context[field]['id']
if self.settabindex and not 'tabindex' in attrs:
- attrs['tabindex'] = form.req.next_tabindex()
+ attrs['tabindex'] = form._cw.next_tabindex()
return name, values, attrs
def process_field_data(self, form, field):
formkey = form.form_field_name(field)
- posted = form.req.form
+ posted = form._cw.form
return posted.get(formkey)
class Input(FieldWidget):
@@ -114,19 +114,19 @@
'
',
tags.input(name=confirmname, value=values[0], type=self.type,
**attrs),
- ' ', tags.span(form.req._('confirm password'),
+ ' ', tags.span(form._cw._('confirm password'),
**{'class': 'emphasis'})]
return u'\n'.join(inputs)
def process_field_data(self, form, field):
passwd1 = super(PasswordInput, self).process_field_data(form, field)
fieldname = form.form_field_name(field)
- passwd2 = form.req.form[fieldname+'-confirm']
+ passwd2 = form._cw.form[fieldname+'-confirm']
if passwd1 == passwd2:
if passwd1 is None:
return None
return passwd1.encode('utf-8')
- raise ProcessFormError(form.req._("password and confirmation don't match"))
+ raise ProcessFormError(form._cw._("password and confirmation don't match"))
class PasswordSingleInput(Input):
""" without a confirmation field"""
@@ -192,7 +192,7 @@
self.attrs['cubicweb:type'] = 'wysiwyg'
def render(self, form, field, renderer):
- form.req.fckeditor_config()
+ form._cw.fckeditor_config()
return super(FCKEditor, self).render(form, field, renderer)
@@ -293,9 +293,9 @@
actual_fields = field.fields
assert len(actual_fields) == 2
return u'