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

Requested reviews:
  loco-directory-dev (loco-directory-dev)
Related bugs:
  #616652 ACL checks explode when LP is down
  https://bugs.launchpad.net/bugs/616652

-- 
https://code.launchpad.net/~dholbach/loco-directory/616652/+merge/32430
Your team loco-directory-dev is requested to review the proposed merge of 
lp:~dholbach/loco-directory/616652 into lp:loco-directory.
=== modified file 'loco_directory/common/launchpad.py'
--- loco_directory/common/launchpad.py	2010-07-30 16:14:42 +0000
+++ loco_directory/common/launchpad.py	2010-08-12 13:41:36 +0000
@@ -24,8 +24,12 @@
     try:
         launchpad = Launchpad.login_anonymously(client_ident, lp_instance, cachedir)
     except:
-        # Support for launchpadlib pre 1.5.4.
-        launchpad = Launchpad.login(client_ident, "", "", lp_instance, cachedir)
+        try:
+            # Support for launchpadlib pre 1.5.4.
+            launchpad = Launchpad.login(client_ident, "", "", lp_instance, cachedir)
+        except:
+            # Launchpad might be offline.
+            return None
     return launchpad
 
 def is_user_on_loco_council(user):
@@ -54,6 +58,8 @@
         return True
     # more complicated check :-/
     lp = lp_login()
+    if not lp:
+        return False
     try:
         lp_team = lp.people[team.lp_name]
     except:

=== modified file 'loco_directory/teams/management/commands/lpupdate.py'
--- loco_directory/teams/management/commands/lpupdate.py	2010-07-01 11:58:05 +0000
+++ loco_directory/teams/management/commands/lpupdate.py	2010-08-12 13:41:36 +0000
@@ -7,6 +7,7 @@
 from django.contrib.auth.models import Group
 
 from datetime import datetime
+import sys
 
 def update_admins(ld_team, lp_team):
     ld_admin_names = set([a.lpid for a in ld_team.admins.all()])
@@ -25,6 +26,8 @@
 
     def handle_noargs(self, **options):
         lp = launchpad.lp_login()
+        if not lp:
+            sys.exit(1)
         TEAM_BLACKLIST = (u"ubuntu-lococouncil", u"ubuntu-games-merged")
         
         existing_locos = models.Team.objects.all()

=== modified file 'loco_directory/teams/management/commands/update-languages.py'
--- loco_directory/teams/management/commands/update-languages.py	2010-07-15 14:28:03 +0000
+++ loco_directory/teams/management/commands/update-languages.py	2010-08-12 13:41:36 +0000
@@ -6,11 +6,15 @@
 
 from common import launchpad
 
+import sys
+
 class Command(NoArgsCommand):
     help = "Update list of continents and countries."
 
     def handle_noargs(self, **options):
         lp = launchpad.lp_login()
+        if not lp:
+            sys.exit(1)
         ld_languages = models.Language.objects.all()
         lp_language_names = set([(a.english_name, a.code) for a in lp.languages.getAllLanguages()])
         ld_language_names = set([(a.name, a.code) for a in ld_languages])

_______________________________________________
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