Sorry, a bit too complicated to follow easily as is. Could you either 
simplify further or attach a packed app that demonstrates the problem (and 
describe the exact workflow to reproduce the problem). Note, I see you are 
adding hidden _formname and _formkey fields to the form, but it doesn't 
appear you actually do anything with them (you are not using web2py's form 
processing functionality to create and check the _formkey).

Anthony

On Friday, August 9, 2013 10:40:42 AM UTC-4, Lamps902 wrote:
>
> Sure. The version I'm using is "
> 2.5.1-stable+timestamp.2013.06.06.15.39.19". The function's really long, 
> so I'll try to distill and abstract what's going on to the relevant parts, 
> and change the var names to something more helpful when taken out of their 
> original context. I've verified that this abstracted function reproduces 
> the error.
>
> There's a helper function that generates the form:
>
> def generate_form( ... ):
>     if image_width and image_height:
>         image_width, image_height = image_width if image_width else '15px'
> , image_height if image_height else '15px'
>        
>         inputs =  [INPUT(_type = 'image', _src = path_join('/',*
> image_location_list), _alt = image_alt_text,
>                   _style = 'width:' + image_width + ';height:' +image_height
> )]
>     else:
>         inputs = [INPUT(_type = 'submit', _value = 
> label),hidden_variable_inputs
> ]
>        
>     inputs.extend([INPUT(_type = 'hidden', _name = name, _value = value) 
> for (name, value) in hidden_vars_tuple_list])
>    
>     if form_name:
>         inputs.append(INPUT(_type = 'hidden', _name = '_formname', _value 
> = form_name))
>     if form_key:
>         inputs.append(INPUT(_type = 'hidden', _name = '_formkey', _value 
> =form_key
> ))
>    
>     return = FORM(inputs)
>
> A helper that generates the panel:
>
> def generate_panel(owner_id, letter_id):
>     
>     return TABLE(TR(TD(generate_single_item_form(
>                  hidden_vars_tuple_list = [('letter_id',letter_id),(
> 'action','important')], 
>                  form_name = 'important_form', form_key = web2py_uuid())))
>
> And the user-facing controller function:
>
> @auth.requires_login()
> def attempt_to_reproduce_error():
>
>     if request.vars.action:
>      
>         try:
>             letter_created_on_datetime = db.t_letters(request.vars.
> letter_id).created_on
>         except:
>             letter_created_on_datetime = None
>         
>         if 'important' == request.vars.action and request.vars.letter_id 
> and letter_created_on_datetime:
>             try:
>                 cur_letter_flags = db.t_letters(request.vars.letter_id).
> letter_flags
>                 cur_letter_flags.remove('important') if 'important' 
> incur_letter_flags 
> else cur_letter_flags.append('important') 
>                 db(db.t_letters.id == 
> request.vars.letter_id).update(letter_flags 
> = cur_letter_flags)
>                 del request.vars.letter_id
>             except:
>                 pass
>     
>     try:
>         letters_set = db(db.t_letters.user_id == session.auth.user.id)
>     except:
>         pass
>
>                                    
>     letters_board__div = DIV([ DIV(DIV(letter.letter_title.capitalize(),_class
> ='letter_title'),
>                                   DIV(A(format_user_name(formatting = 'first, 
> last, id', **fetch_user_name_by_id(letter.user_id, 'dict')),
>                                      _href=URL('default','show_user', vars
> =dict(user_id=letter.user_id))), 
>                                      _class='letter_post_author') if 
> (notletter
> .user_id == letter.owner_id) else '', 
>                                   TABLE(TR(TD(generate_panel(owner_id=
> session.auth.user.id, letter_id=letter.id),_class='letter_post_panel'),
>                                            TD(_id='buffer_0'),
>                                            TD(letter.letter_body, _class=
> 'letter_post_body')
>                                          _id = 'letter_body__row'), _id = 
> 'letter_body__table'),
>                                   DIV(letter.created_on, _class=
> 'letter_created_on__div'), 
>                                      _class = 
> 'letter_important_container__div'   \
>                                      if 'important' in letter.letter_flags 
> else 'letter_container__div')
>                                   for letter in letters_set.select(orderby
> =~db.t_letters.created_on)],
>                                       _class = 
> 'letter_thread_container__div', ) 
>                                 
>     return dict(letter_board = letters_board__div, create_letter_panel = 
> '', message = '')    
>
>
>
> On Wednesday, August 7, 2013 2:49:46 PM UTC-5, Anthony wrote:
>>
>> On Wednesday, August 7, 2013 11:26:05 AM UTC-4, Lamps902 wrote:
>>
>>> The method of the forms was left at default/wasn't explicitly set, so 
>>> they had the 'post' method. Setting the method to 'get' seems to fix the 
>>> problem.
>>>
>>
>> Hmm, I would have expected the opposite. Can you show an example of code 
>> that produces the problem? What version of web2py are you using?
>>
>> Anthony 
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to