Lines 185-193
Link Here
|
185 |
return self._full_path |
185 |
return self._full_path |
186 |
|
186 |
|
187 |
def getListAddress(self, extra=None): |
187 |
def getListAddress(self, extra=None): |
|
|
188 |
posting_addr = self.internal_name() |
189 |
try: |
190 |
posting_addr = self.real_name |
191 |
except: |
192 |
pass |
188 |
if extra is None: |
193 |
if extra is None: |
189 |
return '%s@%s' % (self.internal_name(), self.host_name) |
194 |
return '%s@%s' % (posting_addr, self.host_name) |
190 |
return '%s-%s@%s' % (self.internal_name(), extra, self.host_name) |
195 |
return '%s-%s@%s' % (posting_addr, extra, self.host_name) |
191 |
|
196 |
|
192 |
# For backwards compatibility |
197 |
# For backwards compatibility |
193 |
def GetBouncesEmail(self): |
198 |
def GetBouncesEmail(self): |
Lines 473-480
Link Here
|
473 |
def Create(self, name, admin, crypted_password, |
478 |
def Create(self, name, admin, crypted_password, |
474 |
langs=None, emailhost=None): |
479 |
langs=None, emailhost=None): |
475 |
assert name == name.lower(), 'List name must be all lower case.' |
480 |
assert name == name.lower(), 'List name must be all lower case.' |
476 |
if Utils.list_exists(name): |
|
|
477 |
raise Errors.MMListAlreadyExistsError, name |
478 |
# Validate what will be the list's posting address. If that's |
481 |
# Validate what will be the list's posting address. If that's |
479 |
# invalid, we don't want to create the mailing list. The hostname |
482 |
# invalid, we don't want to create the mailing list. The hostname |
480 |
# part doesn't really matter, since that better already be valid. |
483 |
# part doesn't really matter, since that better already be valid. |
Lines 482-492
Link Here
|
482 |
# the admin's email address, so transform the exception. |
485 |
# the admin's email address, so transform the exception. |
483 |
if emailhost is None: |
486 |
if emailhost is None: |
484 |
emailhost = mm_cfg.DEFAULT_EMAIL_HOST |
487 |
emailhost = mm_cfg.DEFAULT_EMAIL_HOST |
485 |
postingaddr = '%s@%s' % (name, emailhost) |
488 |
firstname = name |
|
|
489 |
if '@' in name: |
490 |
firstname, emailhost = name.split('@', 1) |
491 |
# Keep posting address sane. |
492 |
postingaddr = '%s@%s' % (firstname, emailhost) |
493 |
name = '%s-%s' % (firstname, emailhost) |
486 |
try: |
494 |
try: |
487 |
Utils.ValidateEmail(postingaddr) |
495 |
Utils.ValidateEmail(postingaddr) |
488 |
except Errors.MMBadEmailError: |
496 |
except Errors.MMBadEmailError: |
489 |
raise Errors.BadListNameError, postingaddr |
497 |
raise Errors.BadListNameError, postingaddr |
|
|
498 |
# Refuse to create lists that already exists |
499 |
if Utils.list_exists(name): |
500 |
raise Errors.MMListAlreadyExistsError, name |
490 |
# Validate the admin's email address |
501 |
# Validate the admin's email address |
491 |
Utils.ValidateEmail(admin) |
502 |
Utils.ValidateEmail(admin) |
492 |
self._internal_name = name |
503 |
self._internal_name = name |
Lines 494-499
Link Here
|
494 |
# Don't use Lock() since that tries to load the non-existant config.pck |
505 |
# Don't use Lock() since that tries to load the non-existant config.pck |
495 |
self.__lock.lock() |
506 |
self.__lock.lock() |
496 |
self.InitVars(name, admin, crypted_password) |
507 |
self.InitVars(name, admin, crypted_password) |
|
|
508 |
# This is for getListAddress |
509 |
self.list_address = postingaddr |
510 |
self.real_name = firstname |
511 |
self.subject_prefix = mm_cfg.DEFAULT_SUBJECT_PREFIX % self.__dict__ |
497 |
self.CheckValues() |
512 |
self.CheckValues() |
498 |
if langs is None: |
513 |
if langs is None: |
499 |
self.available_languages = [self.preferred_language] |
514 |
self.available_languages = [self.preferred_language] |
Lines 1335-1341
Link Here
|
1335 |
addresses in the recipient headers. |
1350 |
addresses in the recipient headers. |
1336 |
""" |
1351 |
""" |
1337 |
# This is the list's full address. |
1352 |
# This is the list's full address. |
1338 |
listfullname = '%s@%s' % (self.internal_name(), self.host_name) |
1353 |
listfullname = self.getListAddress() |
1339 |
recips = [] |
1354 |
recips = [] |
1340 |
# Check all recipient addresses against the list's explicit addresses, |
1355 |
# Check all recipient addresses against the list's explicit addresses, |
1341 |
# specifically To: Cc: and Resent-to: |
1356 |
# specifically To: Cc: and Resent-to: |