diff --git a/twander.py b/twander.py index 45f0aea..7ae2763 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.209 2006/12/19 00:13:16 tundra Exp $" +RCSID = "$Id: twander.py,v 3.210 2006/12/19 09:12:05 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -22,12 +22,13 @@ # Imports # #----------------------------------------------------------# +from socket import getfqdn +from stat import * import getopt +from fnmatch import fnmatch import mutex import os import re -from socket import getfqdn -from stat import * import sys import thread import time @@ -589,7 +590,7 @@ ASSIGN = "=" # Assignment for variable definitions ASSOCBLANK = "RESETASSOC" # Internally used to indicate a blank ASSOC RHS ASSOCDFLT = "*" # Symbol for default association action -ASSOCEXCL = "-" # Symbol for association exclusion action +ASSOCEXCL = "!" # Symbol for association exclusion action ASSOCIATE = "ASSOC" # Association keyword CONF = "" # Config file user selected with -c option COMMENT = r"#" # Comment introducer string @@ -1779,7 +1780,11 @@ # Blank RHS implies user wants association removed if cmd == ASSOCBLANK: - del UI.Associations[cmdname] + if cmdname == ASSOCEXCL: # Null out the exclusion list + UI.Associations[cmdname] = [] + else: + if cmdname in UI.Associations: # Only blank out entries if they actually exist + del UI.Associations[cmdname] # Process association exclusions @@ -3603,16 +3608,24 @@ # Apply any relevant association information, skipping types # found in the exclusion list + + # Skip things on the exclude list Don't bother checking + # against ASSOCDFLT and ASSOCEXCL - they are not "real" + # associations + excluded = False for exclude in UI.Associations[ASSOCEXCL]: - if selected.endswith(exclude) or (OSPLATFORM == 'win32' and selected.lower().endswith(exclude.lower())): + if (exclude != ASSOCDFLT) and (exclude != ASSOCEXCL) and fnmatch(selected, exclude): excluded = True + # Check the selection against every named association, but skip + # the ASSOCDFLT and ASSOCEXCL associations because they are + # special directives and not "real" associations. + assocfound = False if not excluded: - for assoc in UI.Associations: - if selected.endswith(assoc) or (OSPLATFORM == 'win32' and selected.lower().endswith(assoc.lower())): + if (assoc != ASSOCDFLT) and (assoc != ASSOCEXCL) and fnmatch(selected, assoc): selected = UI.Associations[assoc] assocfound = True