root/alternc-mailman/trunk/patches/mailman-true-virtual-2.1.4.patch

Revision 2208, 5.1 kB (checked in by anarcat, 5 months ago)

first attempt at integrating the VirtualMailman patches

  • ./bin/newlist

    old new  
    133133    host_name = None 
    134134    web_page_url = None 
    135135    if '@' in listname: 
    136         listname, domain = listname.split('@', 1) 
     136        firstname, domain = listname.split('@', 1) 
    137137        host_name = mm_cfg.VIRTUAL_HOSTS.get(domain, domain) 
    138138        web_page_url = mm_cfg.DEFAULT_URL_PATTERN % domain 
    139 -- Mailman/Gui/General.py.orig Wed Mar 16 15:46:55 2005 
     139++ Mailman/Gui/General.py      Wed Mar 16 15:47:21 2005 
     
    413413 
    414414    def _setValue(self, mlist, property, val, doc): 
    415415        if property == 'real_name' and \ 
    416                val.lower() <> mlist.internal_name().lower(): 
     416               val.lower() <> mlist.real_name.lower(): 
    417417            # These values can't differ by other than case 
    418418            doc.addError(_("""<b>real_name</b> attribute not 
    419419            changed!  It must differ from the list's name by case 
  • Mailman/MailList.py

    old new  
    183183        return self._full_path 
    184184 
    185185    def getListAddress(self, extra=None): 
     186        posting_addr = self.internal_name() 
     187        try: 
     188            posting_addr = self.real_name.lower() 
     189        except: 
     190            pass 
    186191        if extra is None: 
    187             return '%s@%s' % (self.internal_name(), self.host_name) 
    188         return '%s-%s@%s' % (self.internal_name(), extra, self.host_name) 
     192            return '%s@%s' % (posting_addr, self.host_name) 
     193        return '%s-%s@%s' % (posting_addr, extra, self.host_name) 
    189194 
    190195    # For backwards compatibility 
    191196    def GetBouncesEmail(self): 
     
    434439    # 
    435440    def Create(self, name, admin, crypted_password, 
    436441               langs=None, emailhost=None): 
    437         if Utils.list_exists(name): 
    438             raise Errors.MMListAlreadyExistsError, name 
    439442        # Validate what will be the list's posting address.  If that's 
    440443        # invalid, we don't want to create the mailing list.  The hostname 
    441444        # part doesn't really matter, since that better already be valid. 
    442445        # However, most scripts already catch MMBadEmailError as exceptions on 
    443446        # the admin's email address, so transform the exception. 
    444         if emailhost is None: 
    445             emailhost = mm_cfg.DEFAULT_EMAIL_HOST 
    446         postingaddr = '%s@%s' % (name, emailhost) 
     447        if emailhost is None: 
     448            emailhost = mm_cfg.DEFAULT_EMAIL_HOST 
     449        # default, for when no domain is given 
     450        firstname = name 
     451        # we set a special name for virtual hosted lists 
     452        if '@' in name: 
     453            firstname, emailhost = name.split('@', 1) 
     454            name = "%s-%s" % (firstname, emailhost) 
     455        # but we keep a sensible posting address 
     456        postingaddr = '%s@%s' % (firstname, emailhost) 
    447457        try: 
    448458            Utils.ValidateEmail(postingaddr) 
    449459        except Errors.MMBadEmailError: 
    450460            raise Errors.BadListNameError, postingaddr 
    451461        # Validate the admin's email address 
    452462        Utils.ValidateEmail(admin) 
     463        if Utils.list_exists(name): 
     464            raise Errors.MMListAlreadyExistsError, name 
    453465        self._internal_name = name 
    454466        self._full_path = Site.get_listpath(name, create=1) 
    455467        # Don't use Lock() since that tries to load the non-existant config.pck 
    456468        self.__lock.lock() 
    457469        self.InitVars(name, admin, crypted_password) 
    458470        self.CheckValues() 
     471        # this is for getListAddress 
     472        self.list_address = postingaddr 
     473        self.real_name = firstname 
     474        self.subject_prefix = mm_cfg.DEFAULT_SUBJECT_PREFIX % self.__dict__ 
    459475        if langs is None: 
    460476            self.available_languages = [self.preferred_language] 
    461477        else: 
     
    12431260        to or cc addrs.""" 
    12441261        # BAW: fall back to Utils.ParseAddr if the first test fails. 
    12451262        # this is the list's full address 
    1246         listfullname = '%s@%s' % (self.internal_name(), self.host_name
     1263        listfullname = self.getListAddress(
    12471264        recips = [] 
    12481265        # check all recipient addresses against the list's explicit addresses, 
    12491266        # specifically To: Cc: and Resent-to: 
     
    12951308            addr = addr.lower() 
    12961309            localpart = addr.split('@')[0] 
    12971310            if (# TBD: backwards compatibility: deprecated 
    1298                     localpart == self.internal_name() or 
     1311                    localpart == self.real_name.lower() or 
    12991312                    # exact match against the complete list address 
    13001313                    addr == listfullname): 
    13011314                return 1 
Note: See TracBrowser for help on using the browser.