Following is my script which has where() function and update()
function,the where function works fine,but the update() function seems
does not work at all.Does anyone know what happened?
===============================================
class register(object):
myform = form.Form(
form.Textbox("email"),
form.Textbox("code"),
)
def GET(self):
return unamed.render.register()
def POST(self):
form = register.myform()
form.validates()
code = form.d.code
result = unamed.db.where('magic_map', magic_id=
code,child='None')
if result:
if unamed.db.where('radcheck',username = form.d.email):
return 'Sorry the {0} is already
registered!'.format(form.d.email)
else:
if True:
a = unamed.db.update('radius.magic_map',where =
"magic_id = '{0}'".format(code),child = 'sss', _test=True )
print a.query()
print a.values()
print 'come here'
return 'Welcome {0}!'.format(form.d.email)
else:
return 'Sorry error occured
{0}!'.format(form.d.email)
else:
return 'Sorry the promotion code is already used or not
exists.'
==================================================
And the log in the backend is like this:
============output from uwsgi.log=================
0.0 (1): SELECT * FROM magic_map WHERE magic_id = '332w2' AND child =
'None'
0.0 (2): SELECT * FROM radcheck WHERE username = '[email protected]'
UPDATE magic_map SET child = %s WHERE magic_id = '332w2'
[u'[email protected]']
come here
[pid: 734|app: 0|req: 7/12] 16.44.164.45 () {50 vars in 982 bytes}
[Tue Apr 19 12:00:56 2011] POST /register => generated 19 bytes in 13
msecs (HTTP/1.1 200) 1 headers in 98 bytes (2 switches on core 0)
[pid: 731|app: 0|req: 4/13] 16.44.164.45 () {40 vars in 679 bytes}
[Tue Apr 19 12:00:56 2011] GET /favicon.ico => generated 9 bytes in 4
msecs (HTTP/1.1 404) 2 headers in 130 bytes (2 switches on core 0)
============================================
And the database remains the same....
--
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en.