Actually, the problem is not unexpected parameters. Look at what Diez
wrote, and look at the error again. In particular, formencode is
trying to turn the string "title" into an int

ValueError: invalid literal for int() with base 10: 'title'

Using what Diez told us, it's easy to see why: formencode is expecting
that names which have a "-" in them are actually variables with array
indexes.

The fix is to do what Diez said: Add a filter that changes
"mobiletag-title" into "mobiletag_title". If you don't do this, then
when you have an actual form with an actual problem, you won't be able
to figure out why things are broken.

For instance, if your form, when being displayed, winds up with
"addresses-None" instead of "addresses-0", formencode won't handle the
parameter name correctly, meaning it raises an exception. Your form is
expecting an addresses array, but doesn't get the data, and it's
because you've hidden the failure away rather than fixing the root
cause.

On Mon, Oct 11, 2010 at 12:04 PM, Remi Jolin <[email protected]> wrote:
>  Le 11/10/2010 17:23, Diez B. Roggisch a écrit :
>>
>> If it works... I think it's not really ok, because in the end, it can't be
>> the
>> expectation of somebody who produces URLs for a web-application that it
>> expects all kinds of additional variables. I mean - what's the use of
>> these in
>> the first place, if they are simply ignored?
>
> Well, TG (in prod configuration) is supposed to silently ignore unexpected
> parameters. So why would it crash if there is a - in an unexpected parameter
> name ?
>
>   # Set to True if you'd like to abort execution if a controller gets an
>   # unexpected parameter. False by default
>   # tg.strict_parameters = False
>
>
> --
> 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.
>
>



-- 
Michael J. Pedersen
My IM IDs: Jabber/[email protected], ICQ/103345809, AIM/pedermj022171
          Yahoo/pedermj2002, MSN/[email protected]

-- 
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