Project

General

Profile

« Previous | Next » 

Revision bd6363fe

Added by Frédéric Péters almost 14 years ago

Add support for an expiration time for announces

View differences:

extra/modules/announces.py
53 53

  
54 54
    publication_time = None
55 55
    modification_time = None
56
    expiration_time = None
56 57
    sent_by_email_time = None
57 58
    sent_by_sms_time = None
58 59
    theme = None
......
158 159
        announces = cls.select(lambda x: not x.hidden)
159 160
        announces.sort(lambda x,y: cmp(x.publication_time or x.modification_time,
160 161
                    y.publication_time or y.modification_time))
161
        announces = [x for x in announces if x.publication_time < time.gmtime()]
162
        announces = [x for x in announces if x.publication_time < time.gmtime()
163
                     and (x.expiration_time is None or x.expiration_time > time.gmtime())]
162 164
        announces.reverse()
163 165
        return announces
164 166
    get_published_announces = classmethod(get_published_announces)

Also available in: Unified diff