Hello,
I have a simple function in a controller and it seems to be getting
called twice. Any ideas why, and what to do about it?
def index():
try:
rows = db( (db.gtsign.auth_user_id==request.vars['c']) \
& (db.gtsign.id==request.vars['s']) \
& (db.gtsign.auth_user_id==db.auth_user.id)).select()
auth_user=rows.first().auth_user
gtsign=rows.first().gtsign
pattern = re.compile(r'[^\d]')
phoneDigits = pattern.sub('', auth_user.telephone)
use_count = gtsign.use_count + 1
db.gtsign[gtsign.id] = dict(use_count=use_count)
return dict(gtsign=gtsign, auth_user=auth_user,
phoneDigits=phoneDigits)
except Exception, err:
redirect(URL('invalid'))
The symptom is that gtsign.use_count is going up by 2 instead of by 1
every time the page is loaded from a mobile phone. I see this in the
Apache log file:
97.87.95.138 - - [20/Jan/2011:20:20:40 -0600] "GET
//gotosigns/?c=1&s=19 HTTP/1.1" 200 1500 "-" "Mozilla/5.0 (Linux; U;
Android 2.1-update1; en-us; SPH-D700 Build/ECLAIR)
AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17"
97.87.95.138 - - [20/Jan/2011:20:20:40 -0600] "HEAD
//gotosigns/?c=1&s=19 HTTP/1.1" 200 590 "-" "Mozilla/5.0 (Linux; U;
Android 2.1-update1; en-us; SPH-D700 Build/ECLAIR)
AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17"
I am running web2py Version 1.91.6 (2011-01-03 17:55:14) on Linux and
Apache with mod_wsgi.
Thanks,
-- Art Z.