Andre Meyer schrieb:
> On Dec 27, 2007 1:44 PM, Diez B. Roggisch <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
>     Give your buttons the same name, e.g. action. Then you can do something
>     like this:
> 
>     @expose()
>     def edit_tag(self, action=None, tg_errors=None, *kwargs):
>         return getattr(self, "action_%s" % action)(tg_errors=tg_errors,
>     **kwargs)
> 
> 
> Thanks. Nice idea. This means, however, that the method name for the 
> action depends on the text on the button, which is a bit problematic 
> considering i18n and maintainability, imho.


Sure - alternatively, call all of them

action_<something>

and then filter the request.params for the action-prefix.

> It would be much easier if cp generated a 'submit' slot with the value 
> of the html name tag in request.params, so {..., 'submit': 'update_tag'} 
> instead of the current {.., 'update_tag': 'update', ...}, but well...
>

But how should it - it doesn't know which of your values stem from the 
submit-buttons and which not.

Diez


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to