Esempio n. 1
0
    def archive(self, year, month, day):
        criteria = []
        criteria.append(Post._page == False)
        if year: criteria.append(db.extract('year',Post.created_date)==year)
        if month: criteria.append(db.extract('month',Post.created_date)==month)
        if day: criteria.append(db.extract('day',Post.created_date)==day)

        q = reduce(db.and_, criteria)
        return self.filter(q).order_by(Post.created_date.desc())
Esempio n. 2
0
    def archive(self,year,month,day):
        if not year:
            return self

        criteria = []
        criteria.append(db.extract('year',Post.created_date)==year)
        if month:criteria.append(db.extract('month'.Post.created_date)==month)
        if day:criteria.append(db.extract('day',Post.created_date)==day)

        q = reduce(db.and_,criteria)
        return self.filter(q)
Esempio n. 3
0
    def archive(self, year, month, day):
        if not year:
            return self

        criteria = []
        criteria.append(db.extract('year', Post.created_date) == year)
        if month:
            criteria.append(db.extract('month', Post.created_date) == month)
        if day: criteria.append(db.extract('day', Post.created_date) == day)

        q = reduce(db.and_, criteria)
        return self.filter(q)