Attachment 'mailman-true-virtual-2.1.13.patch'

Download

   1 diff -Naur -ur -x '*.pyc' mailman-2.1.13/bin//newlist mailman_patch_2.1.13/bin//newlist
   2 --- mailman-2.1.13/bin//newlist	2011-06-23 19:40:28.000000000 +0000
   3 +++ mailman_patch_2.1.13/bin//newlist	2011-06-23 19:39:07.000000000 +0000
   4 @@ -164,7 +164,8 @@
   5  
   6      if '@' in listname:
   7          # note that --urlhost and --emailhost have precedence
   8 -        listname, domain = listname.split('@', 1)
   9 +        #listname, domain = listname.split('@', 1)
  10 +	firstname, domain = listname.split('@', 1)
  11          urlhost = urlhost or domain
  12          emailhost = emailhost or mm_cfg.VIRTUAL_HOSTS.get(domain, domain)
  13  
  14 diff -Naur -ur -x '*.pyc' mailman-2.1.13/bin//rmlist mailman_patch_2.1.13/bin//rmlist
  15 --- mailman-2.1.13/bin//rmlist	2009-12-22 18:00:43.000000000 +0000
  16 +++ mailman_patch_2.1.13/bin//rmlist	2011-06-23 19:39:07.000000000 +0000
  17 @@ -92,6 +92,11 @@
  18          usage(1)
  19      listname = args[0].lower().strip()
  20  
  21 +    if '@' in listname:
  22 +        # note that --urlhost and --emailhost have precedence
  23 +        firstname, domain = listname.split('@', 1)
  24 +	listname = '%s-%s' % ( firstname, domain )
  25 +
  26      removeArchives = False
  27      for opt, arg in opts:
  28          if opt in ('-a', '--archives'):
  29 diff -Naur -ur -x '*.pyc' mailman-2.1.13/Mailman//Gui/General.py mailman_patch_2.1.13/Mailman//Gui/General.py
  30 --- mailman-2.1.13/Mailman//Gui/General.py	2009-12-22 18:00:43.000000000 +0000
  31 +++ mailman_patch_2.1.13/Mailman//Gui/General.py	2011-06-23 19:39:14.000000000 +0000
  32 @@ -426,7 +426,7 @@
  33  
  34      def _setValue(self, mlist, property, val, doc):
  35          if property == 'real_name' and \
  36 -               val.lower() <> mlist.internal_name().lower():
  37 +               val.lower() <> mlist.real_name.lower():
  38              # These values can't differ by other than case
  39              doc.addError(_("""<b>real_name</b> attribute not
  40              changed!  It must differ from the list's name by case
  41 diff -Naur -ur -x '*.pyc' mailman-2.1.13/Mailman//Handlers/CookHeaders.py mailman_patch_2.1.13/Mailman//Handlers/CookHeaders.py
  42 --- mailman-2.1.13/Mailman//Handlers/CookHeaders.py	2009-12-22 18:00:43.000000000 +0000
  43 +++ mailman_patch_2.1.13/Mailman//Handlers/CookHeaders.py	2011-06-23 19:39:16.000000000 +0000
  44 @@ -180,7 +180,9 @@
  45      if msgdata.get('_nolist') or not mlist.include_rfc2369_headers:
  46          return
  47      # This will act like an email address for purposes of formataddr()
  48 -    listid = '%s.%s' % (mlist.internal_name(), mlist.host_name)
  49 +    #listid = '%s.%s' % (mlist.internal_name(), mlist.host_name)
  50 +    # internal_name already contains the hostname with the vhost patch
  51 +    listid = mlist.internal_name()
  52      cset = Utils.GetCharSet(mlist.preferred_language)
  53      if mlist.description:
  54          # Don't wrap the header since here we just want to get it properly RFC
  55 diff -Naur -ur -x '*.pyc' mailman-2.1.13/Mailman//MailList.py mailman_patch_2.1.13/Mailman//MailList.py
  56 --- mailman-2.1.13/Mailman//MailList.py	2009-12-22 18:00:43.000000000 +0000
  57 +++ mailman_patch_2.1.13/Mailman//MailList.py	2011-06-23 19:39:09.000000000 +0000
  58 @@ -185,9 +185,15 @@
  59          return self._full_path
  60  
  61      def getListAddress(self, extra=None):
  62 -        if extra is None:
  63 -            return '%s@%s' % (self.internal_name(), self.host_name)
  64 -         return '%s-%s@%s' % (self.internal_name(), extra, self.host_name)
  65 +        posting_addr = self.internal_name()
  66 +        try:
  67 +            posting_addr = self.real_name.lower()
  68 +        except:
  69 +            pass
  70 +        if extra is None:
  71 +            return '%s@%s' % (posting_addr, self.host_name)
  72 +        return '%s-%s@%s' % (posting_addr, extra, self.host_name)
  73  
  74      # For backwards compatibility
  75      def GetBouncesEmail(self):
  76 @@ -488,11 +494,20 @@
  77          # the admin's email address, so transform the exception.
  78          if emailhost is None:
  79              emailhost = mm_cfg.DEFAULT_EMAIL_HOST
  80 -        postingaddr = '%s@%s' % (name, emailhost)
  81 +        # default, for when no domain is given
  82 +        firstname = name
  83 +        # we set a special name for virtual hosted lists
  84 +        if '@' in name:
  85 +            firstname, emailhost = name.split('@', 1)
  86 +            name = "%s-%s" % (firstname, emailhost)
  87 +        # but we keep a sensible posting address
  88 +        postingaddr = '%s@%s' % (firstname, emailhost)
  89          try:
  90              Utils.ValidateEmail(postingaddr)
  91          except Errors.EmailAddressError:
  92              raise Errors.BadListNameError, postingaddr
  93 +        if Utils.list_exists(name):
  94 +            raise Errors.MMListAlreadyExistsError, name
  95          # Validate the admin's email address
  96          Utils.ValidateEmail(admin)
  97          self._internal_name = name
  98 @@ -501,6 +516,10 @@
  99          self.__lock.lock()
 100          self.InitVars(name, admin, crypted_password)
 101          self.CheckValues()
 102 +        # this is for getListAddress
 103 +        self.list_address = postingaddr
 104 +        self.real_name = firstname
 105 +        self.subject_prefix = mm_cfg.DEFAULT_SUBJECT_PREFIX % self.__dict__
 106          if langs is None:
 107              self.available_languages = [self.preferred_language]
 108          else:
 109 @@ -1341,7 +1360,7 @@
 110          addresses in the recipient headers.
 111          """
 112          # This is the list's full address.
 113 -        listfullname = '%s@%s' % (self.internal_name(), self.host_name)
 114 +        listfullname = self.getListAddress()
 115          recips = []
 116          # Check all recipient addresses against the list's explicit addresses,
 117          # specifically To: Cc: and Resent-to:
 118 @@ -1356,7 +1375,7 @@
 119              addr = addr.lower()
 120              localpart = addr.split('@')[0]
 121              if (# TBD: backwards compatibility: deprecated
 122 -                    localpart == self.internal_name() or
 123 +                    localpart == self.real_name.lower() or
 124                      # exact match against the complete list address
 125                      addr == listfullname):
 126                  return True

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2011-06-28 13:21:48, 5.7 KB) [[attachment:mailman-true-virtual-2.1.13.patch]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.