On Monday 07 July 2008 16:13:40 Mark Ramm wrote:
> > However I totally disagree with the proposed solution of passing only one
> > parameter value!!! This opens up a whole can of worms. It will introduce
> > subtle errors that stem from re-ordered input fields in HTML-forms as
> > well as browser and HTTP-request-parsing implementations.
>
> Well, this is the standard behavior of webob and pylons in the same
> way that the old way was the standard behavior for CherryPy.   So,
> it's not so much that I'm proposing this as a solution, as it's a
> default that we'd have to deviate from.

I see. I still think that it' s a bug in pylons/webob, even if it was by 
design.

Silently discarding input is bad IMHO. If one wants to prevent ugly code like

if isinstance(param, list):
   ...
else:
  ...

the better thing might even be to raise an exception and make declaration of 
multi-parameters explicit & required. Or at least issue a warning in the 
logs.

And I don't see anything but a decorator that can do the declaration 
transparently.

> The difference being that webob and pylons give you a params MultiDict
> directly, not as parameters to your python function.

I don't understand this. Do you mean that they don't pass parameters to 
controllers, but a dictionary instead? I've so far never worked with pylons 
directly.

> One possibility that I've been contemplating is a @no_params decorator
> that you can use if you don't care if the incoming parameters are
> passed to your function, and you just want to use the params MultiDict
> directly.   Of course we could do both this and create an
> @as_list('value1', 'value2') like decorator (which is one proposal).

or maybe

@as_list(value1=True, value2=True)

I like the keywords a bit better because that makes them visually equivalent 
to the parameter-list, albeit I admit that the "=True"-part isn't to 
beautiful as well.

Of course the decorator could be implemented accepting both notations.

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to