On 12/6/05, Peter Kahn <[EMAIL PROTECTED]> wrote:
> I am working on a little project and I have a form with 12 fields. In
> theory, I will need a controller method with 12 parameters in it to handle
> this form. This seems like a problem as methods with many parameters are
> painful and an easy source of errors. In Martin Fowler's book on
> Refactoring he suggests replacing many parameters with an object to improve
> sustainability.
>
> I believe I can use the cgi field storage object, but I still seem to need
> a bunch of params or the frameworks report errors. Can someone point me to
> the pattern used for turbogears when deailing with complex forms? Thanks...
Yes, 12 is too many and too painful to contemplate for individual
arguments. Luckily, Python itself points the way...
@turbogears.expose
def yourmethod(self, **kw):
print kw["myfield"]
Kevin