Esempio n. 1
0
    def get(self, id):
        id = int(id)
        product_list = product_id_list_by_com_id(self.zsite.id)
        product = Po.mc_get(id)
        if product:
            if id not in product_list:
                self.redirect('/bio/new')

            return self.render(product_list=Po.mc_get_list(product_list),
                               product=product,
                               com_id=self.zsite.id,
                               position=1)
        self.redirect('/')
Esempio n. 2
0
    def get(self, id):
        id = int(id)
        product_list = product_id_list_by_com_id(self.zsite.id)
        product = Po.mc_get(id)
        if product:
            if id not in product_list:
                self.redirect('/bio/new')

            return self.render(
                        product_list=Po.mc_get_list(product_list),
                        product=product,
                        com_id=self.zsite.id,
                        position=1
                   )
        self.redirect('/')
Esempio n. 3
0
    def post(self):
        arguments = self.request.arguments
        zsite_id = self.zsite_id
        id = arguments.get('id')
        product_url = arguments.get('product_url', ())
        product_name = arguments.get('product_name', ())
        product_about = arguments.get('product_about', ())

        pros = zip(id, product_url, product_name, product_about)
        pros = filter(lambda p : bool(p[2]), pros)

        if pros:
            for id, product_url, product_name, product_about in pros:

                po = Po.mc_get(id)
                if po.zsite_id != zsite_id:
                    continue

                po.name_ = product_name
                po.save()
                info_json = JsDict(json.loads(po.txt or '{}'))
                info_json.product_url = product_url
                info_json.product_about = product_about

                po_product_update(id, info_json)


        return self.get()
Esempio n. 4
0
    def post(self):
        arguments = self.request.arguments
        zsite_id = self.zsite_id
        id = arguments.get('id')
        product_url = arguments.get('product_url', ())
        product_name = arguments.get('product_name', ())
        product_about = arguments.get('product_about', ())

        pros = zip(id, product_url, product_name, product_about)
        pros = filter(lambda p: bool(p[2]), pros)

        if pros:
            for id, product_url, product_name, product_about in pros:

                po = Po.mc_get(id)
                if po.zsite_id != zsite_id:
                    continue

                po.name_ = product_name
                po.save()
                info_json = JsDict(json.loads(po.txt or '{}'))
                info_json.product_url = product_url
                info_json.product_about = product_about

                po_product_update(id, info_json)

        return self.get()
Esempio n. 5
0
 def get(self, id):
     product = None
     if id:
         product = Po.mc_get(id)
     if product:
         self.render( product=product, com_id=self.zsite.id, edit=True)
     else:
         self.redirect('/')
Esempio n. 6
0
 def get(self, id):
     product = None
     if id:
         product = Po.mc_get(id)
     if product:
         self.render(product=product, com_id=self.zsite.id, edit=True)
     else:
         self.redirect('/')
Esempio n. 7
0
    def post(self, id=0):
        product_list = product_id_list_by_com_id(self.zsite.id)
        id = int(id)
        product = Po.mc_get(id)
        if product:
            self._product_save(product)

            if product_list[-1] != id:
                return self.redirect('/product/new/%s'%(product_list[product_list.index(id)+1]))
            else:
                return self.redirect('/bio/new')

        self.redirect('/')
Esempio n. 8
0
    def post(self, id=0):
        product_list = product_id_list_by_com_id(self.zsite.id)
        id = int(id)
        product = Po.mc_get(id)
        if product:
            self._product_save(product)

            if product_list[-1] != id:
                return self.redirect(
                    '/product/new/%s' %
                    (product_list[product_list.index(id) + 1]))
            else:
                return self.redirect('/bio/new')

        self.redirect('/')
Esempio n. 9
0
 def post(self, id):
     product = Po.mc_get(id)
     if product.zsite_id == self.zsite_id:
         self._product_save(product)
     self.redirect('/#product_%s'%id)
Esempio n. 10
0
 def post(self, id):
     product = Po.mc_get(id)
     if product.zsite_id == self.zsite_id:
         self._product_save(product)
     self.redirect('/#product_%s' % id)