>
>    if form.process().accepted:
>        i = form.vars.nmbreinvit
>        invitsgenere = generate_invitation(i)
>

Try:

invitsgenere = generate_invitation(int(i))

In your form, the submitted value is stored as a string, and as a string it 
will always evaluate to > i in your generate_invitation() function, which 
causes the infinite while loop. So, convert it to an integer before passing 
it to the function. You should probably also add the IS_INT_IN_RANGE 
validator to the input field. An alternative is to build the form using 
SQLFORM.factory with Field('nmbreinvit', 'integer'), and I believe in that 
case form.process() will convert the value to an integer for you, so you 
can then pass it directly to the generate_invitation() function.

Anthony

Reply via email to