SVN: r22959 - trunk/quixote/form2
Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Mon, 03 Nov 2003 12:16:09 -0500
| Newsgroups | gmane.comp.web.quixote.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: nascheme
Date: 2003-11-03 12:16:09 -0500 (Mon, 03 Nov 2003)
New Revision: 22959
Modified:
trunk/quixote/form2/form.py
Log:
Improve WidgetRow docstring. Don't use apply().
Modified: trunk/quixote/form2/form.py
===================================================================
--- trunk/quixote/form2/form.py 2003-11-03 17:03:19 UTC (rev 22958)
+++ trunk/quixote/form2/form.py 2003-11-03 17:16:09 UTC (rev 22959)
@@ -63,7 +63,10 @@
class WidgetRow(FormComponent):
- """Standard wrapper for widgets added to a Form.
+ """
+ Standard wrapper for widgets added to a Form: renders each widget in
+ a couple of table rows (one for the widget title, and another for
+ the widget itself, along with error and/or hint text).
Instance attribues:
widget : Widget
@@ -73,8 +76,8 @@
"""
def __init__(self, name, widget_class, value, title=None, hint=None,
- required=False, **args):
- self.widget = apply(widget_class, (name, value), args)
+ required=False, **kwargs):
+ self.widget = widget_class(name, value, **kwargs)
self.title = title
self.hint = hint
self.required = required
@@ -341,12 +344,12 @@
"""
if not issubclass(klass, FormComponent):
raise TypeError, 'FormComponent subclass required (got %r)' % klass
- component = apply(klass, (name,) + args, kwargs)
+ component = klass(name, *args, **kwargs)
self._add_name(name, component)
self.components.append(component)
def add(self, klass, name, value=None,
- title=None, hint=None, required=False, **args):
+ title=None, hint=None, required=False, **kwargs):
"""(Widget,
name : string,
value : any = None,
@@ -361,8 +364,8 @@
"""
if issubclass(klass, HiddenWidget):
raise TypeError, "use add_hidden() to add hidden widgets"
- apply(self.add_component, (self.WIDGET_ROW_CLASS, name, klass, value,
- title, hint, required), args)
+ self.add_component(self.WIDGET_ROW_CLASS, name, klass, value,
+ title, hint, required, **kwargs)
def add_submit(self, name, value):