home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.6)
-
-
- def get_birthdays(bdays, now):
- import datetime
- today = datetime.date.fromtimestamp(now)
- new = { }
- for uid, d_ in bdays.items():
- bd = d_.get('birthday_date')
- if bd is not None:
- mdy = [
- None] * 3
- vals = [ int(i) for i in bd.split('/') ]
- mdy[:len(vals)] = vals
- (m, d, y) = mdy
- bd_date_this = datetime.date(today.year, m, d)
- bd_date_next = datetime.date(today.year + 1, m, d)
- keep = False
- if (bd_date_this - today).days < (bd_date_this - today).days:
- pass
- elif (bd_date_this - today).days <= 7:
- keep = True
- bd_date = bd_date_this
- elif (bd_date_next - today).days < (bd_date_next - today).days:
- pass
- elif (bd_date_next - today).days <= 7:
- keep = True
- bd_date = bd_date_next
-
- if keep:
- new[uid] = dict(d_)
- new[uid]['bday'] = bd_date
- if y is not None:
- born_on = datetime.date(y, m, d)
- new[uid]['age'] = int(((bd_date - born_on).days + 1) / 365)
-
-
- keep
-
- return sorted(new.items(), key = (lambda foo: foo[1]['bday']))
-
-