Пример #1
0
def test_insert():
    for i in range(1, 101):
        book = Book()
        index = (i + 1) / 2
        book.isbn = '%05d001' % (index)
        book.price = (index) * 1.0
        book.title = 'title-%d' % (index)
        book.author = 'author-%s' % (index)
        book.press = 'press-%s' % (index / 10)
        book.description = 'description for book-%d' % (index)
        book.cover = 'cover-%d' % (index)

        book.link = 'http://www.oricinus_price/book-%d-%d' % (index, i % 2)
        book.platform = i % 2
        book.instant_price = book.price * 0.8
        book.crawling_time = i

        book_dao.insert(book)
Пример #2
0
def test_insert():
    for i in range(1,101):
        book = Book()
        index = (i+1) / 2
        book.isbn = '%05d001'%(index)
        book.price = (index)*1.0
        book.title = 'title-%d'%(index)
        book.author = 'author-%s'%(index)
        book.press = 'press-%s'%(index / 10)
        book.description = 'description for book-%d'%(index)
        book.cover = 'cover-%d'%(index)

        book.link = 'http://www.oricinus_price/book-%d-%d'%(index, i%2)
        book.platform = i % 2
        book.instant_price = book.price * 0.8
        book.crawling_time = i

        book_dao.insert(book)
Пример #3
0
    def __parse_po_to_book(self, bookpo, goodspo):
        book = Book()

        # bookpo->book
        book.isbn = bookpo.isbn
        book.price = bookpo.price
        book.title = bookpo.title
        book.author = bookpo.author
        book.press = bookpo.press
        book.description = bookpo.description
        book.cover = bookpo.cover

        #goodspo->book
        book.link = goodspo.link
        book.platform = goodspo.platform
        book.instant_price = goodspo.instant_price
        book.crawling_time = goodspo.crawling_time

        return book