Commits

albertoconnor committed dcf9d80 Merge

Merge.

  • Participants
  • Parent commits 0c612fc, 1163967
  • Tags 0.4

Comments (0)

Files changed (5)

File README.rst

File contents unchanged.

File django_mailman/management/__init__.py

Empty file added.

File django_mailman/management/commands/__init__.py

Empty file added.

File django_mailman/management/commands/list_lists.py

+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2013 Rodolphe Quiédeville <rodolphe@quiedeville.org>
+#
+"""
+List all lists
+"""
+from django.core.management.base import BaseCommand
+from django_mailman.models import List
+
+
+class Command(BaseCommand):
+    help = 'List all lists with their url on stdout'
+
+    def handle(self, *args, **options):
+        for olist in List.objects.all():
+            self.stdout.write("%s - %s\n" % (olist.name,
+                                             olist.main_url))

File django_mailman/models.py

 # -*- coding: utf-8 -*-
 import re
 import urllib2
+import logging
 from types import UnicodeType
 
 from django.db import models
 
 from webcall import MultipartPostHandler
 
+logger = logging.getLogger(__name__)
+
 # Mailman-Messages for a successfull subscription
 SUBSCRIBE_MSG = (
     u'Erfolgreich eingetragen', # de
         opener = urllib2.build_opener(MultipartPostHandler(self.encoding))
 
         all_members = []
-        content = opener.open(url, data).read()
+        try:
+            content = opener.open(url, data).read()
+        except urllib2.HTTPError as error:
+            logger.error("%s %s" % (error, url))
+            return []
+    
         (letters, members, chunks) = self.__parse_member_content(content, self.encoding)
         all_members.extend(members)
         for letter in letters: