Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2497 (closed defect: invalid)

Opened 9 years ago

Last modified 9 years ago

post request not passing proper list parameter

Reported by: mapleoin Owned by:
Priority: low Milestone: 2.1rc1
Component: TurboGears Version: 2.0.3
Severity: normal Keywords:
Cc:

Description

Hello,

I'm using webtest to test my application and doing something similar to the following

app.post('/', {mylist: [1,2,3]})

In the controller, I have a post method defined on a RestController.

The request reaches the controller with mylist set to a string: "[1, 2, 3]" instead of a list.

Encoding everything in the url like so:

app.post('/?mylist=1&mylist=2&mylist=3', )

is a little better, because it sets mylist to ['1','2','3']. It's still not the same as [1, 2, 3], but at least I know that there's nothing wrong with my controller.

Change History

comment:1 follow-up: ↓ 2 Changed 9 years ago by chrisz

  • Milestone changed from __unclassified__ to 2.1rc1

comment:2 in reply to: ↑ 1 Changed 9 years ago by mramm

  • Priority changed from normal to low
  • Status changed from new to closed
  • Resolution set to invalid

Replying to chrisz:

Well, it should come through as a string, unless you have a validator to do the conversions for you. That said, the dict of parameters work, but not a dict containing a list of values, and the place where this would have to change is inside of webtest.

And ultimately since webtest can't know that we automatically turn a bunch of strings with the same param into a list in the controller I'm not sure it will ever be changed there.

So, I guess in the end if we want to make this work we'll have to either wrap or subclass webtest, which I'm a bit hesitant to do...

If you feel strongly feel free to raise the issue on the trunk mailing list and we can decide what to do.

Note: See TracTickets for help on using tickets.