[Zope3-checkins] Re: [Checkins] SVN: z3c.form/branches/pcardune-tweaks/src/z3c/form/button.py added an adapter hook to allow for customized ButtonAction objects. Not sure what the best way to test this is.

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Jun 19 09:00:25 EDT 2007


On Thursday 14 June 2007 09:42, Paul Carduner wrote:
> Modified: z3c.form/branches/pcardune-tweaks/src/z3c/form/button.py
> ===================================================================
> --- z3c.form/branches/pcardune-tweaks/src/z3c/form/button.py    2007-06-14
> 13:39:36 UTC (rev 76693) +++
> z3c.form/branches/pcardune-tweaks/src/z3c/form/button.py    2007-06-14
> 13:42:53 UTC (rev 76694) @@ -221,7 +221,12 @@
>              if button.condition is not None and not
> button.condition(self.form): continue
>              fullName = prefix + name
> -            buttonAction = ButtonAction(self.request, button, fullName)
> +            # Look up a button action factory
> +            buttonAction = zope.component.queryMultiAdapter(
> +                (self.request, button, fullName), interfaces.IFieldWidget)
> +            # if one is not found, use the default
> +            if buttonAction is None:
> +                buttonAction = ButtonAction(self.request, button,
> fullName) # Look up a potential custom title for the action.
>              title = zope.component.queryMultiAdapter(
>                  (self.form, self.request, self.content, button, self),

Looks good; this can be added to the trunk, after an appropriate test is 
written.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-Checkins mailing list