Update of /cvsroot/tmda/tmda/TMDA
In directory usw-pr-cvs1:/tmp/cvs-serv1082/TMDA
Modified Files:
ChangeLog FilterParser.py
Log Message:
As with *-ezmlm, the *-mailman sources now have a higher-level
interface. The match now just specifies the list directory instead of
the configuration database itself. e.g,
from-mailman -attr=members ~mailman/lists/viewnet-news ok
We now locate the config database automatically since it can be
assumed to be either of 'config.db' or 'config.pck' depending on which
version of MM is in use.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/ChangeLog,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -r1.199 -r1.200
--- ChangeLog 9 May 2002 17:01:22 -0000 1.199
+++ ChangeLog 9 May 2002 19:40:05 -0000 1.200
@@ -3,6 +3,9 @@
* FilterParser.py (FilterParser.firstmatch): *-ezmlm sources now
match the parent directory DIR rather than DIR/subscribers.
+ (FilterParser.firstmatch): *-mailman sources now match just the
+ list directory. The config database is located automatically.
+
2002-05-02 Jason R. Mastaler <jasonrm@xxxxxxxxxxxxxxxxxxxxxxxxxx>
* MTA.py (MTA.deliver): Deliver the message according to
Index: FilterParser.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/FilterParser.py,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- FilterParser.py 9 May 2002 17:01:22 -0000 1.36
+++ FilterParser.py 9 May 2002 19:40:05 -0000 1.37
@@ -549,7 +549,7 @@
break
if found_match:
break
- # Mailman list-configuration databases.
+ # Mailman configuration databases.
if source in ('from-mailman', 'to-mailman'):
match = os.path.expanduser(match)
try:
@@ -557,20 +557,18 @@
except KeyError:
raise MatchError(lineno,
'"%s" missing -attr argument' % source)
- # The filename is expected to be in the format of
- # either 'filename.db', or 'filename.pck'.
- dbsuffix = string.split(match, '.')[-1]
- # If the filename ends with `.db', then it is
- # assumed that the file contains a Python marshal
- # (MM 2.0). If the file ends with `.pck' then it
- # is assumed to contain a Python pickle (MM 2.1).
- if dbsuffix == 'db':
- import marshal
- Serializer = marshal
- elif dbsuffix == 'pck':
- import cPickle
- Serializer = cPickle
- mmdb_file = open(match, 'r')
+ # Find the Mailman configuration database.
+ # 'config.db' is a Python marshal used in MM 2.0, and
+ # 'config.pck' is a Python pickle used in MM 2.1.
+ config_db = os.path.join(match, 'config.db')
+ config_pck = os.path.join(match, 'config.pck')
+ if os.path.exists(config_pck):
+ dbfile = config_pck
+ import cPickle as Serializer
+ elif os.path.exists(config_db):
+ dbfile = config_db
+ import marshall as Serializer
+ mmdb_file = open(dbfile, 'r')
mmdb_data = Serializer.load(mmdb_file)
mmdb_file.close()
mmdb_addylist = mmdb_data[mmdb_key]
@@ -578,7 +576,7 @@
if type(mmdb_addylist) is types.DictType:
mmdb_addylist = mmdb_data[mmdb_key].keys()
for addy in keys:
- if addy and string.lower(addy) in mmdb_addylist:
+ if addy and addy.lower() in mmdb_addylist:
found_match = 1
break
if found_match:
_______________________________________________
tmda-cvs mailing list
http://libertine.org/lists/listinfo/tmda-cvs
|