There is another way:

project_id=2&elem=forms&elem_id=2

That "fixes" this "problem".

mdipierro wrote:
> I think the issue is that they changed the behavior of the cgi module
> (http://bugs.python.org/issue1817) so that if the same variable
> appears both in the URL and in the submitted form it gets parsed
> twice. This creates an ambiguity because the application (in this case
> web2py) cannot tell if the field is submitted twice because of a
> <input multiple> or because of it appears both in URL and the body of
> the request.
>
> I cannot resolve this issue within web2py because python 2.5 and 2.6
> are simply not compatible. They call it a bug fix but it not. There is
> no protocol to my knowledge that says one of the two ways is better
> than other. The new way (2.6) actually creates an ambiguity so it
> seems worse to me.
>
> The only solution I have is do not pass
>
> project_id=2&elem=forms&id=2
>
> but pass
> /[projectid]/[elem]/[id]  == /2/forms/2
>
> instead.
>
> Auth performs some ugly checks to avoid this imcompatibility issue.
>
> If you have any suggestion please let me know.
>
> Massimo
>
>
> On Jun 27, 7:39 pm, Jędrzej Nowak <[email protected]> wrote:
> > hey! sorry for "spamming" on list, but Groups definitely doesn't works
> > for me...
> >
> > anyway thats output that you requested:
> > -----
> > /manager/default/edit_elem
> > -----
> > project_id=2&elem=forms&id=2
> > -----
> > <Storage {'info': 'cokolwiek tutaj edit', 'name': 'test form add',
> > 'form_fields': 'costam', 'elem': 'forms', 'id': ['2', '2'],
> > '_formkey': 'ad0d4a8c-2c01-4562-8d0a-d30252e90bee', 'project_id': '2',
> > '_formname': 'forms_2'}>
> > -----
> > <Storage {'project_id': '2', 'elem': 'forms', 'id': '2'}>
> > -----
> > <Storage {'info': 'cokolwiek tutaj edit', 'project_id': '2', 'name':
> > 'test form add', 'form_fields': 'costam', '_formname': 'forms_2',
> > '_formkey': 'ad0d4a8c-2c01-4562-8d0a-d30252e90bee', 'elem': 'forms',
> > 'id': ['2', '2']}>
> > -----
> >
> > "id" field is list... the question is WHY ?
> >
> > On Jun 28, 2:02 am, mdipierro <[email protected]> wrote:
> >
> > > 2.6 and 2.6.1 seem to have a cgi module that behave strangely.
> > > This will work for sure with 2.5. and should work fine with 2.6.2.
> >
> > > Massimo
> >
> > > On Jun 27, 6:09 pm, Yarko Tymciurak <[email protected]> wrote:
> >
> > > > You want to have at least 2.6.2...
> >
> > > > 2009/6/27 Jędrzej Nowak <[email protected]>
> >
> > > > > Wrrr... I'm trying to post 5th time... Maybe now...
> >
> > > > > I'm using 2.6, but as I know 2.6 is compatible with 2.5...
> >
> > > > > On Jun 27, 4:26 pm, mdipierro <[email protected]> wrote:
> > > > > > Are you using Python 2.5 or Python 2.6?
> >
> > > > > > Massimo
> >
> > > > > > On Jun 27, 9:16 am, pigmej <[email protected]> wrote:
> >
> > > > > > > traceback:
> > > > > > > Traceback (most recent call last):
> > > > > > >   File "/home/pigmej/moje/web2py/gluon/restricted.py", line 107, 
> > > > > > > in
> > > > > > > restricted
> > > > > > >     exec ccode in environment
> > > > > > >   File "/home/pigmej/moje/web2py/applications/manager/controllers/
> > > > > > > default.py", line 167, in <module>
> > > > > > >   File "/home/pigmej/moje/web2py/gluon/globals.py", line 100, in
> > > > > > > <lambda>
> > > > > > >     self._caller = lambda f: f()
> > > > > > >   File "/home/pigmej/moje/web2py/gluon/tools.py", line 1307, in f
> > > > > > >     if not self.has_permission(name, table_name, record_id):
> > > > > > >   File "/home/pigmej/moje/web2py/gluon/tools.py", line 1435, in
> > > > > > > has_permission
> > > > > > >     == record_id).select(permission.group_id)
> > > > > > >   File "/home/pigmej/moje/web2py/gluon/sql.py", line 1601, in 
> > > > > > > __eq__
> > > > > > >     return SQLQuery(self, '=', value)
> > > > > > >   File "/home/pigmej/moje/web2py/gluon/sql.py", line 1918, in 
> > > > > > > __init__
> > > > > > >     right = sql_represent(right, left.type, left._db._dbname)
> > > > > > >   File "/home/pigmej/moje/web2py/gluon/sql.py", line 377, in
> > > > > > > sql_represent
> > > > > > >     return str(int(obj))
> > > > > > > TypeError: int() argument must be a string or a number, not 'list'
> >
> > > > > > > in admin everything works fine.
> >
> > > > > > > In my app not:
> > > > > > > On adding new "project" I'm doing this:
> > > > > > >         group_id=auth.add_group(role="xxx_
> > > > > > > %s"%form.vars.id,description="some descr %s"%form.vars.id)
> > > > > > >         auth.add_membership(group_id,auth.user.id)
> > > > > > >         auth.add_permission
> > > > > > > (group_id,"update",db.projects,form.vars.id)
> >
> > > > > > > viewing, creating new records works.
> >
> > > > > > > But when I'm trying to update record ( function decorated by:
> > > > > > > @auth.requires_permission("update","projects",request.vars.id) )
> > > > > > >     form=crud.update(db.projects,request.vars.id)
> > > > > > > form is showing correctly, but after submitting form it crashes
> > > > > > > ( traceback at the beginning )
> > > > > > > The same error is without crud ( custom form )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to