[Mailman-Users] "true-virtual" patch mailfunction: need help

Yassen Damyanov yd at media-c.de
Wed Jan 12 20:56:54 CET 2005


After appliying a patch that was essentially what I found at
http://sourceforge.net/tracker/index.php?func=detail&aid=943827&group_id=103&atid=300103

when trying to edit the general preferences of a list at
https://mydomain.com/mailman/admin/mylist/general

I get:
Error: real_name attribute not changed! It must differ from the list's name by case only

So the new attributes are not saved. When I change the real name of the lits
from 'test' to 'test-mudomain.com' the page data is saved but the whole thing
breaks afterwards.

Can anyone suggest a fix to this or a workaround?
Thanks in advance!

Yassen

------------------------

The differences of the code I run against 2.1.5 original code:

--- ./bin/newlist.ORIG  2005-01-11 18:20:23.000000000 +0100
+++ ./bin/newlist       2005-01-12 20:41:20.000000000 +0100
@@ -126,7 +126,7 @@
     host_name = None
     web_page_url = None
     if '@' in listname:
-        listname, domain = listname.split('@', 1)
+        firstname, domain = listname.split('@', 1)
         host_name = mm_cfg.VIRTUAL_HOSTS.get(domain, domain)
         web_page_url = mm_cfg.DEFAULT_URL_PATTERN % domain

--- ./Mailman/MailList.py.ORIG  2005-01-11 18:25:09.000000000 +0100
+++ ./Mailman/MailList.py       2005-01-12 20:43:38.000000000 +0100
@@ -183,9 +183,16 @@
         return self._full_path

     def getListAddress(self, extra=None):
-        if extra is None:
-            return '%s@%s' % (self.internal_name(), self.host_name)
-        return '%s-%s@%s' % (self.internal_name(), extra, self.host_name)
+         posting_addr = self.internal_name()
+         try:
+             posting_addr = self.real_name
+         except:
+             pass
+         if extra is None:
+         #   return '%s@%s' % (self.internal_name(), self.host_name)
+         #return '%s-%s@%s' % (self.internal_name(), extra, self.host_name)
+             return '%s@%s' % (posting_addr, self.host_name)
+         return '%s-%s@%s' % (posting_addr, extra, self.host_name)

     # For backwards compatibility
     def GetBouncesEmail(self):
@@ -434,8 +441,6 @@
     #
     def Create(self, name, admin, crypted_password,
                langs=None, emailhost=None):
-        if Utils.list_exists(name):
-            raise Errors.MMListAlreadyExistsError, name
         # Validate what will be the list's posting address.  If that's
         # invalid, we don't want to create the mailing list.  The hostname
         # part doesn't really matter, since that better already be valid.
         # the admin's email address, so transform the exception.
         if emailhost is None:
             emailhost = mm_cfg.DEFAULT_EMAIL_HOST
-        postingaddr = '%s@%s' % (name, emailhost)
+        firstname = name
+        domain = mm_cfg.DEFAULT_EMAIL_HOST
+       # we set a special name for virtual hosted lists
+        if '@' in name:
+           firstname, domain = name.split('@', 1)
+            name = "%s-%s" % (firstname, domain)
+       # but we keep a sensible posting address
+        postingaddr = '%s@%s' % (firstname, domain)
         try:
             Utils.ValidateEmail(postingaddr)
         except Errors.MMBadEmailError:
             raise Errors.BadListNameError, postingaddr
         # Validate the admin's email address
         Utils.ValidateEmail(admin)
+        if Utils.list_exists(name):
+            raise Errors.MMListAlreadyExistsError, name
         self._internal_name = name
         self._full_path = Site.get_listpath(name, create=1)
         # Don't use Lock() since that tries to load the non-existant config.pck
         self.__lock.lock()
         self.InitVars(name, admin, crypted_password)
+       # this is for getListAddress
+        self.list_address = postingaddr
+        self.real_name = firstname
+        self.subject_prefix = mm_cfg.DEFAULT_SUBJECT_PREFIX % self.__dict__
         self.CheckValues()
         if langs is None:
             self.available_languages = [self.preferred_language]
@@ -1279,7 +1297,7 @@
         to or cc addrs."""
         # BAW: fall back to Utils.ParseAddr if the first test fails.
         # this is the list's full address
-        listfullname = '%s@%s' % (self.internal_name(), self.host_name)
+        listfullname = self.getListAddress()
         recips = []
         # check all recipient addresses against the list's explicit addresses,
         # specifically To: Cc: and Resent-to:





More information about the Mailman-Users mailing list