Daniel Holbach has proposed merging lp:~dholbach/loco-directory/581641 into 
lp:loco-directory.

Requested reviews:
  loco-directory-dev (loco-directory-dev)
Related bugs:
  #581641 reapprovals throws google maps API warning
  https://bugs.launchpad.net/bugs/581641

-- 
https://code.launchpad.net/~dholbach/loco-directory/581641/+merge/25440
Your team loco-directory-dev is requested to review the proposed merge of 
lp:~dholbach/loco-directory/581641 into lp:loco-directory.
=== modified file 'loco_directory/teams/views.py'
--- loco_directory/teams/views.py	2010-04-27 15:38:25 +0000
+++ loco_directory/teams/views.py	2010-05-17 14:46:32 +0000
@@ -23,12 +23,18 @@
 import datetime
 
 def reapprovals(request):
-    teams = filter(lambda a: a.approved, 
+    teams = filter(lambda a: a.approved and a.expires_date != None, 
                    Team.objects.all().order_by('expires_date'))
     today = datetime.date.today()
     half_a_year = datetime.timedelta(days=180)
-    next_teams = filter(lambda a: a.expires_date <= today+half_a_year, teams)
-    later_teams = filter(lambda a: a.expires_date > today+half_a_year, teams)
+# XXX: we have no idea why, but on loco.ubuntu.com we are dealing with
+# datetime.datetime instead of datetime.date - bug 581641
+    if type(teams[0].expires_date) == datetime.datetime:
+        next_teams = filter(lambda a: a.expires_date.date() <= today+half_a_year, teams)
+        later_teams = filter(lambda a: a.expires_date.date() > today+half_a_year, teams)
+    else:
+        next_teams = filter(lambda a: a.expires_date <= today+half_a_year, teams)
+        later_teams = filter(lambda a: a.expires_date > today+half_a_year, teams)
     context = {
         'next_teams': next_teams,
         'later_teams': later_teams,

_______________________________________________
Mailing list: https://launchpad.net/~loco-directory-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~loco-directory-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to