Skip to content

Commit

Permalink
Update with changes from old jim-adapter branch.
Browse files Browse the repository at this point in the history
Command used:
  $ svn merge svn+ssh://philikon@svn.zope.org/repos/main/Zope3/branches/jim-adapter@41413 \
              svn+ssh://philikon@svn.zope.org/repos/main/Zope3/branches/jim-adapter@66386 .
  • Loading branch information
philikon committed Apr 4, 2006
1 parent 3c5278f commit 6a5ff00
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions form.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,9 @@ def setUpWidgets(form_fields,
widget = component.getMultiAdapter((field, request),
IInputWidget)

prefix = form_field.prefix
if prefix:
prefix = form_prefix + '.' + prefix
else:
prefix = form_prefix
prefix = form_prefix
if form_field.prefix:
prefix += '.' + form_field.prefix

widget.setPrefix(prefix)

Expand All @@ -283,12 +281,17 @@ def setUpInputWidgets(form_fields, form_prefix, context, request,
for form_field in form_fields:
field = form_field.field.bind(context)
widget = _createWidget(form_field, field, request, IInputWidget)

prefix = form_prefix
if form_field.prefix:
form_prefix = form_prefix + '.' + form_field.prefix
prefix += '.' + form_field.prefix

widget.setPrefix(prefix)

if ignore_request:
value = field.default
widget.setRenderedValue(value)
widget.setPrefix(form_prefix)

widgets.append((True, widget))
return Widgets(widgets, len(form_prefix)+1)

Expand Down Expand Up @@ -363,10 +366,11 @@ def setUpEditWidgets(form_fields, form_prefix, context, request,
iface = IInputWidget
widget = _createWidget(form_field, field, request, iface)

prefix = form_prefix
if form_field.prefix:
form_prefix = form_prefix + '.' + form_field.prefix
prefix += '.' + form_field.prefix

widget.setPrefix(form_prefix)
widget.setPrefix(prefix)

if ignore_request or readonly or not widget.hasInput():
# Get the value to render
Expand All @@ -389,9 +393,10 @@ def setUpDataWidgets(form_fields, form_prefix, context, request, data=(),
iface = IInputWidget
widget = _createWidget(form_field, field, request, iface)

prefix = form_prefix
if form_field.prefix:
form_prefix = form_prefix + '.' + form_field.prefix
widget.setPrefix(form_prefix)
prefix += '.' + form_field.prefix
widget.setPrefix(prefix)

if ((form_field.__name__ in data)
and (ignore_request or readonly or not widget.hasInput())
Expand Down Expand Up @@ -506,7 +511,7 @@ def _action_options(success=None, failure=None, condition=None, validator=None,

def _callify(f):
if isinstance(f, str):
callable = lambda form, action, data: getattr(form, f)(action, data)
callable = lambda form, *args: getattr(form, f)(*args)
else:
callable = f

Expand Down

0 comments on commit 6a5ff00

Please sign in to comment.