Esempio n. 1
0
    def get(self):
        # validate access token
        if not self.ValidateToken():
            return

        idd = self.get_argument("id", "")
        name = self.get_argument("name", "")

        cellar = Cellar()

        if idd != "":

            res_id = cellar.InitById(idd)

            if "success" in res_id:
                self.write(json_util.dumps(cellar.Print()))
            else:
                self.write(json_util.dumps(res_id))
        else:

            res_name = cellar.InitByName(name)

            if "success" in res_name:
                self.write(json_util.dumps(cellar.Print()))
            else:
                self.write(json_util.dumps(res_name))
Esempio n. 2
0
    def get(self):
        # validate access token
        if not self.ValidateToken():
            return

        idd = self.get_argument("id", "")

        cellar = Cellar()
        cellar.InitById(idd)

        self.write(json_util.dumps(cellar.Remove()))
        pass
Esempio n. 3
0
    def get(self):
        # validate access token
        if not self.ValidateToken():
            return

        idd = self.get_argument("id", "")

        page = self.get_argument("page", 1)
        items = self.get_argument("items", 10)

        cellar = Cellar()
        response_obj = cellar.InitById(idd)

        if "success" in response_obj:
            self.write(json_util.dumps(cellar.ListProducts(page, items)))
        else:
            self.write(response_obj["error"])