Ouch! You are right. It is an error.

>>> db.comment.image_id.default  =  image.id

This is thread safe but the web2py mechanism to prevent double form
submission breaks if you have two browser windows open on the same
page. In this case you should use SQLFORM.accepts(...session=None...).

Massimo

On Sep 5, 10:14 pm, Jeremy Dillworth <[email protected]> wrote:
> Apologies if this is the wrong place to report/question this, I could
> not find any mention of errata or errors in the manual.
>
> Firstly, I'm looking at the code sample on page 66. It reads:
>
> >>> form  =  crud.create(db.image,  next=URL(r=request,  args=image.id),
> >>>     message='your  comment  is  posted')
>
> I think it should say:
>
> >>> form  =  crud.create(db.comment,  next=URL(r=request,  args=image.id),
> >>>     message='your  comment  is  posted')
>
> (i.e. db.comment not db.image).
>
> Secondly, the line above it may not be an error, but it's confusing
> me. It says:
>
> >>> db.comment.image_id.default  =  image.id
>
> Is this thread-safe?
>
> I noticed this behaves strangely if I have 2 images in the example
> application. I loaded the first image's page in my browser, then
> opened a second tab and opened the second image's page. I returned to
> my first tab and tried to submit a comment. It doesn't seem to work.
> There is no error in the browser and no error ticket. Maybe I simply
> entered the example incorrectly.
>
> Any help would be appreciated.
>
> Thanks,
>
> Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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