Ejemplo n.º 1
0
 def GET(self, id):
     db = get_db()
     item_result = db.query(
         'select html, desc_content, promo_content from crawl_html where crawl_html.item_id=%s'
         % id)
     #web.header("Content-Type", "text/html; charset=utf-8")
     return item_result[0]['html']
Ejemplo n.º 2
0
    def GET(self, id):
        params = web.input()
        page = int(params.page) if hasattr(params, 'page') else 1
        page = max(1, page)
        perpage = int(params.perpage) if hasattr(params, 'perpage') else 20
        try:
            itemid = int(id)
        except:
            itemid = -1

        db = get_db()
        if itemid >= 0:
            results = db.query(
                "select item_images.id, item_id, url, local_url, type, pos, num_id, width, height, disabled, has_thumbnail from item_images,item where item_images.item_id=item.id and item_id=%s order by pos,type,disabled limit %s offset %s"
                % (itemid, perpage, (page - 1) * perpage))

            crawl_results = db.query(
                "select url, type, pos, is_crawled, err_reason from crawl_item_images where item_id=%s"
                % itemid)

            item_result = db.query(
                'select item_id, num_id, detail_url, title, description, pic_url, local_pic_url, html, desc_content, promo_content from item,crawl_html where item.id=crawl_html.item_id and item.id=%s'
                % itemid)
            return render.itemdetail(id, ItemImagesWrapper(results), page,
                                     perpage, item_result[0])
        else:
            results = db.query(
                "select item_id, url, local_url, type, num_id, width, height, disabled from item_images,item where item_images.item_id=item.id order by pos,type,disabled limit %s offset %s"
                % (perpage, (page - 1) * perpage))
            return render.item(id, ItemImagesWrapper(results), page, perpage)
Ejemplo n.º 3
0
    def GET(self):
        params = web.input()
        page = int(params.page) if hasattr(params, 'page') else 1
        page = max(1, page)
        perpage = int(params.perpage) if hasattr(params, 'perpage') else 100

        db = get_db()
        results = db.query('select distinct item_id, item.title, shop.name from item_images,item,shop where item_images.item_id=item.id and item.shop_id=shop.id limit %s offset %s' % (perpage, (page-1)*perpage))

        return render.itemlist(results, page, perpage)
Ejemplo n.º 4
0
    def GET(self):
        params = web.input()
        page = int(params.page) if hasattr(params, 'page') else 1
        page = max(1, page)
        perpage = int(params.perpage) if hasattr(params, 'perpage') else 100

        db = get_db()
        results = db.query(
            'select distinct item_id, item.title, shop.name from item_images,item,shop where item_images.item_id=item.id and item.shop_id=shop.id limit %s offset %s'
            % (perpage, (page - 1) * perpage))

        return render.itemlist(results, page, perpage)
Ejemplo n.º 5
0
    def GET(self, id):
        params = web.input()
        try:
            itemid = int(id)
        except:
            itemid = -1

        db = get_db()
        if itemid >= 0:
            results = db.query("select item_id, url, local_url, type, num_id, width, height, disabled from item_images,item where item_images.item_id=item.id and item_id=%s and disabled=0 order by item_images.id" % itemid)
        else:
            results = []
        return render.imagetile(id, ItemImagesWrapper(results))
Ejemplo n.º 6
0
    def GET(self, id):
        params = web.input()
        try:
            itemid = int(id)
        except:
            itemid = -1

        db = get_db()
        if itemid >= 0:
            results = db.query(
                "select item_id, url, local_url, type, num_id, width, height, disabled from item_images,item where item_images.item_id=item.id and item_id=%s and disabled=0 order by item_images.id"
                % itemid)
        else:
            results = []
        return render.imagetile(id, ItemImagesWrapper(results))
Ejemplo n.º 7
0
    def GET(self, id):
        params = web.input()
        page = int(params.page) if hasattr(params, 'page') else 1
        page = max(1, page)
        perpage = int(params.perpage) if hasattr(params, 'perpage') else 20
        try:
            itemid = int(id)
        except:
            itemid = -1

        db = get_db()
        if itemid >= 0:
            results = db.query("select item_images.id, item_id, url, local_url, type, pos, num_id, width, height, disabled, has_thumbnail from item_images,item where item_images.item_id=item.id and item_id=%s order by pos,type,disabled limit %s offset %s" % (itemid, perpage, (page-1)*perpage))

            crawl_results = db.query("select url, type, pos, is_crawled, err_reason from crawl_item_images where item_id=%s" % itemid)

            item_result = db.query('select item_id, num_id, detail_url, title, description, pic_url, local_pic_url, html, desc_content, promo_content from item,crawl_html where item.id=crawl_html.item_id and item.id=%s' % itemid)
            return render.itemdetail(id, ItemImagesWrapper(results), page, perpage, item_result[0])
        else:
            results = db.query("select item_id, url, local_url, type, num_id, width, height, disabled from item_images,item where item_images.item_id=item.id order by pos,type,disabled limit %s offset %s" % (perpage, (page-1)*perpage))
            return render.item(id, ItemImagesWrapper(results), page, perpage)
Ejemplo n.º 8
0
 def GET(self, id):
     db = get_db()
     results = db.query('select id from item where num_id=%s' % id)
     raise web.seeother('/item/%s' % results[0]['id'])
Ejemplo n.º 9
0
 def GET(self, id):
     db = get_db()
     item_result = db.query('select html, desc_content, promo_content from crawl_html where crawl_html.item_id=%s' % id)
     #web.header("Content-Type", "text/html; charset=utf-8")
     return item_result[0]['html']
Ejemplo n.º 10
0
 def GET(self, id):
     db = get_db()
     results = db.query('select id from item where num_id=%s' % id)
     raise web.seeother('/item/%s' % results[0]['id'])