[Spambayes-checkins] spambayes/spambayes Options.py, 1.89, 1.90 OptionsClass.py, 1.18, 1.19 tokenizer.py, 1.20, 1.21

Tony Meyer anadelonbrin at users.sourceforge.net
Mon Dec 15 04:20:35 EST 2003


Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv14085/spambayes

Modified Files:
	Options.py OptionsClass.py tokenizer.py 
Log Message:
Bah.  ConfigParser lower()s all option names, which is why X- didn't work,
and no doubt the explanation behind Skip's cryptic windows & case-sensitivity
checkin comment (should have figured that out earlier!).  We could subclass
ConfigParser to remove this, but I have no idea what other effects that might
have at this point.

So, back out the X-/x- changes, and instead correct the comments.  "x-" is
the correct prefix (although since config files are case-insensitive in option names,
using "X-" there will work, but should be frowned on).

Index: Options.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Options.py,v
retrieving revision 1.89
retrieving revision 1.90
diff -C2 -d -r1.89 -r1.90
*** Options.py	15 Dec 2003 07:52:41 -0000	1.89
--- Options.py	15 Dec 2003 09:20:33 -0000	1.90
***************
*** 155,159 ****
       BOOLEAN, RESTORE),
  
!     ("X-search_for_habeas_headers", "Search for Habeas Headers", False,
       """If true, search for the habeas headers (see http://www.habeas.com)
       If they are present and correct, this should be a strong ham sign, if
--- 155,159 ----
       BOOLEAN, RESTORE),
  
!     ("x-search_for_habeas_headers", "Search for Habeas Headers", False,
       """If true, search for the habeas headers (see http://www.habeas.com)
       If they are present and correct, this should be a strong ham sign, if
***************
*** 161,165 ****
       BOOLEAN, RESTORE),
  
!     ("X-reduce_habeas_headers", "Reduce Habeas Header Tokens to Single", False,
       """If SpamBayes is set to search for the Habeas headers, nine tokens
       are generated for messages with habeas headers.  This should be fine,
--- 161,165 ----
       BOOLEAN, RESTORE),
  
!     ("x-reduce_habeas_headers", "Reduce Habeas Header Tokens to Single", False,
       """If SpamBayes is set to search for the Habeas headers, nine tokens
       are generated for messages with habeas headers.  This should be fine,

Index: OptionsClass.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/OptionsClass.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** OptionsClass.py	15 Dec 2003 07:48:40 -0000	1.18
--- OptionsClass.py	15 Dec 2003 09:20:33 -0000	1.19
***************
*** 22,32 ****
  via an instance of this class.
  
! Experimental or deprecated options are prefixed with 'X-', borrowing the
  practice from RFC-822 mail.  If the user sets an option like:
  
      [Tokenizer]
!     X-transmogrify: True
  
! and an 'X-transmogrify' or 'transmogrify' option exists, it is set silently
  to the value given by the user.  If the user sets an option like:
  
--- 22,32 ----
  via an instance of this class.
  
! Experimental or deprecated options are prefixed with 'x-', borrowing the
  practice from RFC-822 mail.  If the user sets an option like:
  
      [Tokenizer]
!     x-transmogrify: True
  
! and an 'x-transmogrify' or 'transmogrify' option exists, it is set silently
  to the value given by the user.  If the user sets an option like:
  
***************
*** 34,38 ****
      transmogrify: True
  
! and no 'transmogrify' option exists, but an 'X-transmogrify' option does,
  the latter is set to the value given by the users and a deprecation message
  is printed to standard error.
--- 34,38 ----
      transmogrify: True
  
! and no 'transmogrify' option exists, but an 'x-transmogrify' option does,
  the latter is set to the value given by the users and a deprecation message
  is printed to standard error.
***************
*** 528,532 ****
                  if not self._options.has_key((section, option)):
                      if option.startswith('x-'):
!                         # try setting option without the X- prefix
                          option = option[2:]
                          if self._options.has_key((section, option)):
--- 528,532 ----
                  if not self._options.has_key((section, option)):
                      if option.startswith('x-'):
!                         # try setting option without the x- prefix
                          option = option[2:]
                          if self._options.has_key((section, option)):
***************
*** 534,548 ****
                          # not an error if an X- option is missing
                      else:
!                         l_option = 'x-' + option
!                         u_option = 'X-' + option
                          # going the other way, if the option has been
                          # deprecated, set its x-prefixed version and
                          # emit a warning
!                         if self._options.has_key((section, l_option)):
!                             self.convert_and_set(section, l_option, value)
!                             self._report_deprecated_error(section, option)
!                         elif self._options.has_key((section, u_option)):
!                             self.convert_and_set(section, u_option, value)
!                             self._report_deprecated_error(section, option)
                          else:
                              print >> sys.stderr, (
--- 534,544 ----
                          # not an error if an X- option is missing
                      else:
!                         option = 'x-' + option
                          # going the other way, if the option has been
                          # deprecated, set its x-prefixed version and
                          # emit a warning
!                         if self._options.has_key((section, option)):
!                             self.convert_and_set(section, option, value)
!                             self._report_deprecated_error(section, opt)
                          else:
                              print >> sys.stderr, (

Index: tokenizer.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/tokenizer.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** tokenizer.py	15 Dec 2003 08:33:34 -0000	1.20
--- tokenizer.py	15 Dec 2003 09:20:33 -0000	1.21
***************
*** 1139,1143 ****
  
          # Habeas Headers - see http://www.habeas.com
!         if options["Tokenizer", "X-search_for_habeas_headers"]:
              habeas_headers = [
  ("X-Habeas-SWE-1", "winter into spring"),
--- 1139,1143 ----
  
          # Habeas Headers - see http://www.habeas.com
!         if options["Tokenizer", "x-search_for_habeas_headers"]:
              habeas_headers = [
  ("X-Habeas-SWE-1", "winter into spring"),
***************
*** 1156,1160 ****
                  habeas = msg.get(opt)
                  if habeas is not None:
!                     if options["Tokenizer", "X-reduce_habeas_headers"]:
                          if habeas == val:
                              valid_habeas += 1
--- 1156,1160 ----
                  habeas = msg.get(opt)
                  if habeas is not None:
!                     if options["Tokenizer", "x-reduce_habeas_headers"]:
                          if habeas == val:
                              valid_habeas += 1
***************
*** 1166,1170 ****
                          else:
                              yield opt.lower() + ":invalid"
!             if options["Tokenizer", "X-reduce_habeas_headers"]:
                  # If there was any invalid line, we record as invalid.
                  # If all nine lines were correct, we record as valid.
--- 1166,1170 ----
                          else:
                              yield opt.lower() + ":invalid"
!             if options["Tokenizer", "x-reduce_habeas_headers"]:
                  # If there was any invalid line, we record as invalid.
                  # If all nine lines were correct, we record as valid.





More information about the Spambayes-checkins mailing list