[Mailman-Users] Small issue (hopefully) with upgrading/migrating from v2.1.9 to v2.1.18-1
Mark Sapiro
mark at msapiro.net
Thu Jan 15 03:33:05 CET 2015
On 01/14/2015 04:11 PM, Chris Nulk wrote:
>
> I have run into a small problem. One of the customizations I did was to
> added an additional attribute to the sender filters similar to the
> *_these_nonmembers fields. On the v2.1.9 installation, my customization
> will accept individual email addresses, regex's, and lists. On the
> v2.1.18-1 installation, it only accepts the individual email addresses.
> I took a closer look at the code (GUIBase.py in the Gui directory) and I
> believe the solution lies there.
>
> The code on the v2.1.18-1 installation has some additional checks.
> Specifically, the following:
> # See if this is a context that accepts regular
> # expressions, and that the re is legal
> if wtype == mm_cfg.EmailListEx and
> addr.startswith('^'):
> try:
> re.compile(addr)
> except re.error:
> bad_addrs.append(addr)
> elif (wtype == mm_cfg.EmailListEx and
> addr.startswith('@')
> and property.endswith('_these_nonmembers')):
> # XXX Needs to be reviewed for list at domain names.
> # don't reference your own list
> if addr[1:] == mlist.internal_name():
> bad_addrs.append(addr)
> # check for existence of list? For now allow
> # reference to list before creating it.
> else:
> bad_addrs.append(addr)
>
> On v2.1.9, the code did not check for the 'and
> property.endswith('_these_nonmembers')):'.
>
> I think that addtional check is preventing my additional
> attribute/property from accepting lists in the field.
Correct.
> Before I go off and possibly muck my installation up, can I simply
> duplicate the 'elif' section with the property.endswith code and replace
> the '_these_nonmembers' with my attribute/property?
>
> Or is a better solution to do something list:
> elif (wtype == mm_cfg.EmailListEx and
> addr.startswith('@')
> and (property.endswith('_these_nonmembers')
> or (property.endswith('my_attribute'))):
> Would that work?
>
> Or even more optimially, I am open to the correct solution to my issue.
I would replace the elif clause with
elif (wtype == mm_cfg.EmailListEx and addr.startswith('@') and
(property.endswith('_these_nonmembers') or
property == 'my_attribute')
indented to the proper level.
DRY
--
Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Mailman-Users
mailing list