Have you taken a look at Peppercorn (http://plope.com/peppercorn)? It
offers a way to deserialize forms that is closer to what you're asking,
though not an exact match.

But I think this might be a case where there's no direct translation from
other languages/frameworks into Python/Pyramid. To see a more standard
Python approach for reducing boilerplate and handling forms intelligently,
check out Deform (http://docs.pylonsproject.org/projects/deform/dev/).

Ultimately though if these approaches don't work for your application, it's
easy enough to write a short helper function that will do you want, like
Michael suggested. It might also be helpful to the community to better
understand your use case if you'd like a more specific example of how we'd
approach it in Pyramid.


On Mon, Nov 14, 2011 at 11:19 PM, uday <gotou...@gmail.com> wrote:

> This is different from what I am asking.
>
> On Nov 14, 11:29 pm, Chris McDonough <chr...@plope.com> wrote:
> > On Mon, 2011-11-14 at 13:27 -0500, Chris McDonough wrote:
> > > On Mon, 2011-11-14 at 12:21 -0600, Michael Merickel wrote:
> > > > The "key[subkey]" syntax is not supported in WebOb (I think).
> >
> > > Yeah, sorry.  I meant that when you do this in a form:
> >
> > > <input type="text" name="foo"></input>
> > > <input type="text" name="foo"></input>
> >
> > > You can do in a view:
> >
> > > request.getall('foo')
> >
> > Sorry, rather:
> >
> > request.POST.getall('foo')
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > > On Mon, Nov 14, 2011 at 11:41 AM, Chris McDonough <chr...@plope.com>
> > > > wrote:
> > > >         On Mon, 2011-11-14 at 09:28 -0800, Mengu wrote:
> > > >         > actually, pylons had this. it was
> > > >         request.params.getall('param') but
> > > >         > pyramid does not support this.
> >
> > > >         It does, actually.  It's a WebOb feature (both Pyramid and
> > > >         Pylons use
> > > >         WebOb).
> >
> > > >         - C
> >
> > > >         > On Nov 14, 6:12 pm, Gael Pasgrimaud <g...@gawel.org>
> wrote:
> > > >         > > Hi,
> >
> > > >         > > Are you coming from php ? :)
> >
> > > >         > > WebOb does not handle arrays/hashes and I don't think
> that
> > > >         this is in
> > > >         > > the current roadmap.
> >
> > > >         > > On Mon, Nov 14, 2011 at 7:52 AM, uday <
> gotou...@gmail.com>
> > > >         wrote:
> > > >         > > > Hi  all,
> >
> > > >         > > > I think it is more helpful if we can make form fields
> > > >         processing more
> > > >         > > > convenient which can reduce verbosity in views.
> >
> > > >         > > > for example assume profile model/table has fields
> > > >         username and
> > > >         > > > password
> > > >         > > > in my form i write like    <input type='text'
> > > >         > > > name='profile[username']><input type='password'
> > > >         > > > name='profile[password]'>
> >
> > > >         > > > so when this form is submitted, it would be cool if I
> > > >         can just do
> > > >         > > > like: request.POST['profile'] which gives me a dict of
> > > >         names and
> > > >         > > > values specific to that model/table whatever
> > > >         > > > so if I do request.POST['profile'] = {'username': value
> > > >         entered by
> > > >         > > > user, 'password': value entered by user}
> >
> > > >         > > > is this feature already there? or can it be achieved in
> > > >         any other way?
> > > >         > > > is it related to webob or pyramid?
> > > >         > > > I am ready to work on this to make it available in
> > > >         pyramid, so please
> > > >         > > > give me pointers to work on this.
> >
> > > >         > > > --
> > > >         > > > You received this message because you are subscribed to
> > > >         the Google Groups "pylons-discuss" group.
> > > >         > > > To post to this group, send email to
> > > >         pylons-discuss@googlegroups.com.
> > > >         > > > To unsubscribe from this group, send email to
> > > >         pylons-discuss+unsubscr...@googlegroups.com.
> > > >         > > > For more options, visit this group
> > > >         athttp://groups.google.com/group/pylons-discuss?hl=en.
> >
> > > >         --
> > > >         You received this message because you are subscribed to the
> > > >         Google Groups "pylons-discuss" group.
> > > >         To post to this group, send email to
> > > >         pylons-discuss@googlegroups.com.
> > > >         To unsubscribe from this group, send email to pylons-discuss
> > > >         +unsubscr...@googlegroups.com.
> > > >         For more options, visit this group at
> > > >        http://groups.google.com/group/pylons-discuss?hl=en.
> >
> > > > --
> >
> > > > Michael
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "pylons-discuss" group.
> > > > To post to this group, send email to pylons-discuss@googlegroups.com
> .
> > > > To unsubscribe from this group, send email to pylons-discuss
> > > > +unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/pylons-discuss?hl=en.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups "pylons-discuss" group.
> > > To post to this group, send email to pylons-discuss@googlegroups.com.
> > > To unsubscribe from this group, send email to
> pylons-discuss+unsubscr...@googlegroups.com.
> > > For more options, visit this group athttp://
> groups.google.com/group/pylons-discuss?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To post to this group, send email to pylons-discuss@googlegroups.com.
> To unsubscribe from this group, send email to
> pylons-discuss+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to