Esempio n. 1
0
            return False
        if not self.name:
            return False

        return True

    def save(self):
        if not self.isValid():
            return False

        Repo.create(Brand, self)
        return True

    def update(self):
        brand = Brand.find_by("id", self.id)
        if not self.isValid():
            return False

        Repo.destroy(Brand, self)
        Repo.create(Brand, self)
        return True

    def delete(self):
        return Repo.destroy(Brand, self)

    def find_by(key, value):
        return Repo.select_by(Brand, key, value)


Repo.register(Brand, ["id", "name"])
Esempio n. 2
0
        try:
            datetime.strptime(self.date, "%Y-%m-%d")
        except ValueError:
            return False
        else:
            return True

    def save(self):
        if not self.isValid():
            return False

        Repo.create(Game, self)
        return True

    def update(self):
        if not self.isValid():
            return False

        Repo.destroy(Game, self)
        Repo.create(Game, self)
        return True

    def delete(self):
        return Repo.destroy(Game, self)

    def find_by(key, value):
        return Repo.select_by(Game, key, value)


Repo.register(Game, ["id", "name", "brand_id", "date", "score"])
Esempio n. 3
0
        try:
            datetime.strptime(self.date, "%Y-%m-%d")
        except ValueError:
            return False
        else:
            return True

    def save(self):
        if not self.isValid():
            return False

        Repo.create(Game, self)
        return True

    def update(self):
        if not self.isValid():
            return False

        Repo.destroy(Game, self)
        Repo.create(Game, self)
        return True

    def delete(self):
        return Repo.destroy(Game, self)

    def find_by(key, value):
        return Repo.select_by(Game, key, value)


Repo.register(Game, ["id", "name", "brand_id", "date", "score"])