Add a print statement. You find that the function is being called
twice. A broken link in the page like <img src="broken"/> make cause
that.

Mind that a function that inserts without a form posting is vulnerable
to URL redirection attacks.



On Apr 2, 4:55 pm, Serbitar <rserbi...@googlemail.com> wrote:
> I have the controller:
>
> @auth.requires_login()
> def roll():
>     if request.args(0):
>         step = int(request.args(0))
>     else:
>         return dict(message = "Roll it!")
>     if request.args(1):
>         visible = False
>     else:
>         visible = True
>     result = util.roll_step(step)
>     db.live.insert(username=auth.user.username, value=result,
> step=step, visible=visible)
>     return dict(message = result)
>
> the util.step function just generates some random numbers.
>
> when I call:
>
> application/controller/roll/5
>
> the roll() function inserts ONE entry into the db with visible is True
> (just like intended)
>
> when I call:
>
> application/controller/roll/5/1
>
> or
>
> application/controller/roll/10/3/10
>
> or
>
> application/controller/roll/7/whatever
>
> the function inserts TWO entries into the db (with visible = False,
> like intended). Why does it insert two?
>
> Thanks in advance.

Reply via email to