Thanks Vinicius,

it worked.

if it couldn't find the value, it raised this error:

<type 'exceptions.IndexError'> list index out of range

Is the below way acceptable way of preventing the error message? Or is 
there a shorter way?

    try:
        num_recs = int(grid.element('.web2py_counter')[0].split()[0])
    except Exception, e:
        num_recs = 0
    else:        
        if num_recs > 1:
            response.flash = T('The same zip code exists for more than one 
country. Choose one.')


thanks

Alex

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to