uday, I think you'll want to just prefix your values, then you can iterate
over the POST and turn it into a dictionary:

<input name="profile-name"/>
<input name="profile-email"/>

profile = {}
for k in request.POST.keys():
    if k.startswith('profile-'):
        profile[k[len('profile-'):]] = request.POST.get(k)
name = profile.get('name', 'Bob')

On Mon, Nov 14, 2011 at 12: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 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.
>
>


-- 

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.

Reply via email to