[Spambayes-checkins] spambayes/spambayes Options.py,1.27,1.28

Tony Meyer anadelonbrin at users.sourceforge.net
Fri Apr 18 00:52:03 EDT 2003


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

Modified Files:
	Options.py 
Log Message:
Quick bug fixes before anyone actually tries this out <wink>

Index: Options.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Options.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** Options.py	18 Apr 2003 06:20:38 -0000	1.27
--- Options.py	18 Apr 2003 06:51:59 -0000	1.28
***************
*** 333,340 ****
  "Best cutoff false positive weight", 10.00, "", "[\d]+[\.]?[\d]*",
   False, True),
! ("TestDriver", "best_cutoff_fn_weight",
  "Best cutoff false negative weight", 1.00, "", "[\d]+[\.]?[\d]*",
   False, True),
! ("TestDriver", "best_cutoff_unsure_weight",
  "Best cutoff unsure weight", 0.20, "", "[\d]+[\.]?[\d]*",
   False, True),
--- 333,340 ----
  "Best cutoff false positive weight", 10.00, "", "[\d]+[\.]?[\d]*",
   False, True),
! ("best_cutoff_fn_weight",
  "Best cutoff false negative weight", 1.00, "", "[\d]+[\.]?[\d]*",
   False, True),
! ("best_cutoff_unsure_weight",
  "Best cutoff unsure weight", 0.20, "", "[\d]+[\.]?[\d]*",
   False, True),
***************
*** 1116,1123 ****
                  # *** This will vanish soon, so do not make use of it in
                  #     new code ***
                  old_name = section[0:1].lower() + section[1:] + "_" + opt[0]
!                 setattr(options, old_name, opt[2])
                  old_name = opt[0]
!                 setattr(options, old_name, opt[2])
  
      # not necessary, but convenient shortcuts to self._options
--- 1116,1126 ----
                  # *** This will vanish soon, so do not make use of it in
                  #     new code ***
+                 garbage, converter = all_options[section][opt[0]]
+                 if converter is not None:
+                     value = converter(opt[2])
                  old_name = section[0:1].lower() + section[1:] + "_" + opt[0]
!                 setattr(options, old_name, value)
                  old_name = opt[0]
!                 setattr(options, old_name, value)
  
      # not necessary, but convenient shortcuts to self._options
***************
*** 1216,1220 ****
                      garbage, new_name = option.split('_', 1)
                      if self._options.has_key((section, new_name)):
!                         value = c.get(section, option)
                          setattr(options, option, value) # ugly!
                          option = new_name
--- 1219,1226 ----
                      garbage, new_name = option.split('_', 1)
                      if self._options.has_key((section, new_name)):
!                         fetcher, converter = goodopts[new_name]
!                         value = getattr(c, fetcher)(section, option)
!                         if converter is not None:
!                             value = converter(value)
                          setattr(options, option, value) # ugly!
                          option = new_name





More information about the Spambayes-checkins mailing list