def get_data(k): culture.get_data(k) humor.get_data(k) lang.get_data(k) mythology.get_data(k) name.get_data(k) opinion.get_data(k) personal.get_data(k) food.get_data(k) private.get_data(k) rec.get_data(k) social.get_data(k) user.get_data(k)
def add(): name = request.args.get('username') pwd = request.args.get('pwd') if not name or not pwd: return 'username or passwd is not null' else: sql = "select * from user where name='%s'" % (name.strip()) name_result = user.get_data(sql) if name_result == 'no result': insert_sql = "insert into user (name,passwd) values ('%s','%s')" % (name.strip(),pwd.strip()) user.get_data(insert_sql) return redirect(url_for('index')) else: return 'user is exist!'
def post_edit(): session = get_session() if not session: bottle.redirect('/') luser = user.find(session['uid']) if not luser: bottle.redirect('/logout') data = user.get_data(session['uid']) cold = bottle.request.POST['cold'] hot = bottle.request.POST['hot'] counters.update(data[0],data[1],cold,hot,datetime.date.today(),session['uid']) return bottle.redirect('/report')
def index(): sql = "select * from user" result = user.get_data(sql) return render_template('index.html',data=result)
def delete(): name = request.args.get('user') delete_sql = "delete from user where name='%s'" % name user.get_data(delete_sql) return redirect(url_for('index'))