Exemple #1
0
def test_dao(db):
	dao=BookDao(db)
	book1 ={}
	book1['book_titile']= 'introduce to tornado'
	book1['addr']='4-2-7'
	book2 = {'book_title':'learning python', 'author':'liu dw','publisher':'bca','description':'this is a book about basic knowledge of python', 'addr':'4-2-7', 'price':15.21}
	book3 = {'book_title':'Restful Web Service', 'author':'yunjianfei','publisher':'bca','description':'this is a book about restful web service', 'addr':'4-2-34', 'price':34.14}

	book4 = {'author':'aimer yin', 'publisher':'baihualou', 'description':' kanxinqing', 'addr':'7-8-2','price':34.2}

	#ret = dao.insert_by_dict(book3)
	#print 'insert book : %s, ret: %s' % (str(book3),str(ret))

	#h = dao.get_by_bid(1)
	#print 'get by id, ret: %s'% str(h)
	#ret = dao.get_by_title('kim')
	#print 'get by title ,ret: %s' % str(ret)

	#ret = dao.del_by_bid(14)
	ret=dao.update_by_bid(17,book4)
	print ret
Exemple #2
0
 def initialize(self):
     self.db = self.application.db
     self.bookdao = BookDao(self.db)
     self.Resp = Resp()
Exemple #3
0
 def initialize(self):
     self.db = self.application.db
     self.bookdao = BookDao(self.db)
     self.readerdao = ReaderDao(self.db)
     self.borrowdao = BorrowDao(self.db)
     self.Resp = Resp()