[Spambayes-checkins] spambayes/spambayes OptionsClass.py,1.17,1.18
Tony Meyer
anadelonbrin at users.sourceforge.net
Mon Dec 15 02:48:42 EST 2003
Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv30198/spambayes
Modified Files:
OptionsClass.py
Log Message:
Don't override the built-in file.
It wasn't really clear if "X-" or "x-" was the experimental option prefix, so accept either.
(Personally I think either is as acceptable as picking one of them).
Index: OptionsClass.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/OptionsClass.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** OptionsClass.py 9 Dec 2003 16:31:39 -0000 1.17
--- OptionsClass.py 15 Dec 2003 07:48:40 -0000 1.18
***************
*** 508,513 ****
def merge_files(self, file_list):
! for file in file_list:
! self.merge_file(file)
def convert_and_set(self, section, option, value):
--- 508,513 ----
def merge_files(self, file_list):
! for f in file_list:
! self.merge_file(f)
def convert_and_set(self, section, option, value):
***************
*** 534,547 ****
# 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)
! print >> sys.stderr, (
! "warning: option %s in"
! " section %s is deprecated" %
! (opt, sect))
else:
print >> sys.stderr, (
--- 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, (
***************
*** 629,632 ****
--- 630,638 ----
else:
self.set(sect, opt, val)
+
+ def _report_deprecated_error(self, sect, opt):
+ print >> sys.stderr, (
+ "Warning: option %s in section %s is deprecated" %
+ (opt, sect))
def _report_option_error(self, sect, opt, val, stream, msg):
More information about the Spambayes-checkins
mailing list