diff --git a/twander.py b/twander.py index 656b5cc..d594ed3 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.228 2009/06/28 07:21:32 tundra Exp $" +RCSID = "$Id: twander.py,v 3.229 2009/06/29 21:41:23 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -606,17 +606,18 @@ # Configuration File-Related Constants & Globals ##### -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 -ASSOCIATE = "ASSOC" # Association keyword -CONF = "" # Config file user selected with -c option -COMMENT = r"#" # Comment introducer string -ENVVBL = r'$' # Symbol denoting an environment variable -FAKEFIELD = r'#FAKEFIELD' # Unsplittable field used to preserve PROMPT/YESNO content -STARTUP = r'Starting Up' # Used when doing parse of first config file -VAREXECUTE = r'`' # Indicate we want content of variable name to be executed +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 +ASSOCIATE = "ASSOC" # Association keyword +ASSOCNOCASE = "/" # Introducer used to indicate case-insensitive ASSOCiations +CONF = "" # Config file user selected with -c option +COMMENT = r"#" # Comment introducer string +ENVVBL = r'$' # Symbol denoting an environment variable +FAKEFIELD = r'#FAKEFIELD' # Unsplittable field used to preserve PROMPT/YESNO content +STARTUP = r'Starting Up' # Used when doing parse of first config file +VAREXECUTE = r'`' # Indicate we want content of variable name to be executed # Names Of Conditionals, Directives, And Pre-Defined Symbols @@ -3679,13 +3680,20 @@ # found in the exclusion list - # Skip things on the exclude list Don't bother checking - # against ASSOCDFLT and ASSOCEXCL - they are not "real" - # associations + # Ignore things that are on the exclusion list excluded = False for exclude in UI.Associations[ASSOCEXCL]: - if (exclude != ASSOCDFLT) and (exclude != ASSOCEXCL) and fnmatch(selected, exclude): + + # Handle case-insensitive exclusions + + if exclude[0] == ASSOCNOCASE: + selected = selected.lower() + exclude = exclude[1:].lower() + + # See if there is an exclusion + + if fnmatch(selected, exclude): excluded = True # Check the selection against every named association, but skip @@ -3695,7 +3703,17 @@ assocfound = False if not excluded: for assoc in UI.Associations: - if (assoc != ASSOCDFLT) and (assoc != ASSOCEXCL) and fnmatch(selected, assoc): + + # Handle case-insensitive associations + + tstassoc = assoc + if tstassoc[0] == ASSOCNOCASE: + selected = selected.lower() + tstassoc = tstassoc[1:].lower() + + # See if the selection matches the association + + if (assoc != ASSOCDFLT) and (assoc != ASSOCEXCL) and fnmatch(selected, tstassoc): selected = UI.Associations[assoc] assocfound = True