def addproduct(): res = request.form.to_dict() p = Product(**res) if p.save(): flash("添加成功") else: flash("添加失败") return redirect(url_for("productadd"))
def search(): a = request.form l = Product(**a) res = l.search() names = l.colnames() if res == []: flash('没有查到结果') res.insert(0, names) return render_template('search01.html', formdata=names, listdata=res)
def getform(): a = request.form l = Product(**a) print(l.info) if l.save(): flash("提交成功") else: flash("提交失败") return redirect(url_for("form01"))
def test01(page): print(page) p = Product.fetchall() print(p) b = buffer(*p) print(b) b.send(None) return str(b.send(page))
n = (i + 1) * BUFFERSIZE elif p == 'last': i = i - 1 m = i * BUFFERSIZE n = (i + 1) * BUFFERSIZE elif isinstance(p, int): i = p - 1 m = i * BUFFERSIZE n = (i + 1) * BUFFERSIZE else: pass def getbuf(message, f): try: val = f.send(message) except: f.send(None) val = f.send(message) finally: return val if __name__ == '__main__': from func import Product l = Product.fetchall() b = buffer(*l) print(getbuf(1, b)) print(getbuf('next', b)) print(getbuf('next', b))
def list01(): res = Product.fetchall(10) res.insert(0, Product.colnames()) return render_template('list01.html', data=res)
def search01(): names = Product.colnames() return render_template('search01.html', formdata=names)
def form01(): res = Product.colnames() return render_template('form01.html', data=res)
def test(): p = Product.fetchall__lazy(2) t = p.send(None) return str(t)