[Spambayes-checkins] spambayes/spambayes OptionsClass.py, 1.19, 1.20

Tim Stone tim at fourstonesExpressions.com
Mon Dec 15 23:54:14 EST 2003


Watch the world reel now <wink>

On Mon, 15 Dec 2003 20:48:31 -0800, Tony Meyer 
<anadelonbrin at users.sourceforge.net> wrote:

> Update of /cvsroot/spambayes/spambayes/spambayes
> In directory sc8-pr-cvs1:/tmp/cvs-serv9453/spambayes
>
> Modified Files:
> 	OptionsClass.py
> Log Message:
> Option names are always case insensitive, no matter what.
>
> Index: OptionsClass.py
> ===================================================================
> RCS file: /cvsroot/spambayes/spambayes/spambayes/OptionsClass.py,v
> retrieving revision 1.19
> retrieving revision 1.20
> diff -C2 -d -r1.19 -r1.20
> *** OptionsClass.py	15 Dec 2003 09:20:33 -0000	1.19
> --- OptionsClass.py	16 Dec 2003 04:48:28 -0000	1.20
> ***************
> *** 552,586 ****
>       def display_name(self, sect, opt):
>           '''A name for the option suitable for display to a user.'''
> !         return self._options[sect, opt].display_name()
>       def default(self, sect, opt):
>           '''The default value for the option.'''
> !         return self._options[sect, opt].default()
>       def doc(self, sect, opt):
>           '''Documentation for the option.'''
> !         return self._options[sect, opt].doc()
>       def valid_input(self, sect, opt):
>           '''Valid values for the option.'''
> !         return self._options[sect, opt].valid_input()
>       def no_restore(self, sect, opt):
>           '''Do not restore this option when restoring to defaults.'''
> !         return self._options[sect, opt].no_restore()
>       def is_valid(self, sect, opt, value):
>           '''Check if this is a valid value for this option.'''
> !         return self._options[sect, opt].is_valid(value)
>       def multiple_values_allowed(self, sect, opt):
>           '''Multiple values are allowed for this option.'''
> !         return self._options[sect, opt].multiple_values_allowed()
>
>       def is_boolean(self, sect, opt):
>           '''The option is a boolean value. (Support for Python 2.2).'''
> !         return self._options[sect, opt].is_boolean()
>
>       def convert(self, sect, opt, value):
>           '''Convert value from a string to the appropriate type.'''
> !         return self._options[sect, opt].convert(value)
>
>       def unconvert(self, sect, opt):
>           '''Convert value from the appropriate type to a string.'''
> !         return self._options[sect, opt].unconvert()
>
>       def get_option(self, sect, opt):
> --- 552,586 ----
>       def display_name(self, sect, opt):
>           '''A name for the option suitable for display to a user.'''
> !         return self._options[sect, opt.lower()].display_name()
>       def default(self, sect, opt):
>           '''The default value for the option.'''
> !         return self._options[sect, opt.lower()].default()
>       def doc(self, sect, opt):
>           '''Documentation for the option.'''
> !         return self._options[sect, opt.lower()].doc()
>       def valid_input(self, sect, opt):
>           '''Valid values for the option.'''
> !         return self._options[sect, opt.lower()].valid_input()
>       def no_restore(self, sect, opt):
>           '''Do not restore this option when restoring to defaults.'''
> !         return self._options[sect, opt.lower()].no_restore()
>       def is_valid(self, sect, opt, value):
>           '''Check if this is a valid value for this option.'''
> !         return self._options[sect, opt.lower()].is_valid(value)
>       def multiple_values_allowed(self, sect, opt):
>           '''Multiple values are allowed for this option.'''
> !         return self._options[sect, 
> opt.lower()].multiple_values_allowed()
>
>       def is_boolean(self, sect, opt):
>           '''The option is a boolean value. (Support for Python 2.2).'''
> !         return self._options[sect, opt.lower()].is_boolean()
>
>       def convert(self, sect, opt, value):
>           '''Convert value from a string to the appropriate type.'''
> !         return self._options[sect, opt.lower()].convert(value)
>
>       def unconvert(self, sect, opt):
>           '''Convert value from the appropriate type to a string.'''
> !         return self._options[sect, opt.lower()].unconvert()
>
>       def get_option(self, sect, opt):
> ***************
> *** 588,598 ****
>           if self.conversion_table.has_key((sect, opt)):
>               sect, opt = self.conversion_table[sect, opt]
> !         return self._options[sect, opt]
>
>       def get(self, sect, opt):
>           '''Get an option value.'''
> !         if self.conversion_table.has_key((sect, opt)):
> !             sect, opt = self.conversion_table[sect, opt]
> !         return self.get_option(sect, opt).get()
>
>       def __getitem__(self, key):
> --- 588,598 ----
>           if self.conversion_table.has_key((sect, opt)):
>               sect, opt = self.conversion_table[sect, opt]
> !         return self._options[sect, opt.lower()]
>
>       def get(self, sect, opt):
>           '''Get an option value.'''
> !         if self.conversion_table.has_key((sect, opt.lower())):
> !             sect, opt = self.conversion_table[sect, opt.lower()]
> !         return self.get_option(sect, opt.lower()).get()
>
>       def __getitem__(self, key):
> ***************
> *** 601,612 ****
>       def set(self, sect, opt, val=None):
>           '''Set an option.'''
> !         if self.conversion_table.has_key((sect, opt)):
> !             sect, opt = self.conversion_table[sect, opt]
>           if self.is_valid(sect, opt, val):
> !             self._options[sect, opt].set(val)
>           else:
>               print >> sys.stderr, ("Attempted to set [%s] %s with 
> invalid"
>                                     " value %s (%s)" %
> !                                   (sect, opt, val, type(val)))
>
>       def set_from_cmdline(self, arg, stream=None):
> --- 601,612 ----
>       def set(self, sect, opt, val=None):
>           '''Set an option.'''
> !         if self.conversion_table.has_key((sect, opt.lower())):
> !             sect, opt = self.conversion_table[sect, opt.lower()]
>           if self.is_valid(sect, opt, val):
> !             self._options[sect, opt.lower()].set(val)
>           else:
>               print >> sys.stderr, ("Attempted to set [%s] %s with 
> invalid"
>                                     " value %s (%s)" %
> !                                   (sect, opt.lower(), val, type(val)))
>
>       def set_from_cmdline(self, arg, stream=None):
> ***************
> *** 617,620 ****
> --- 617,621 ----
>           """
>           sect, opt, val = arg.split(':', 2)
> +         opt = opt.lower()
>           try:
>               val = self.convert(sect, opt, val)
> ***************
> *** 716,720 ****
>          if section is not None and option is not None:
>              output.write(self._options[section,
> !                                       option].as_nice_string(section))
>              return output.getvalue()
>
> --- 717,721 ----
>          if section is not None and option is not None:
>              output.write(self._options[section,
> !                                       
> option.lower()].as_nice_string(section))
>              return output.getvalue()
>
> ***************
> *** 724,728 ****
>              if section is not None and sect != section:
>                  continue
> !            output.write(self._options[sect, opt].as_nice_string(sect))
>          return output.getvalue()
>
> --- 725,729 ----
>              if section is not None and sect != section:
>                  continue
> !            output.write(self._options[sect, 
> opt.lower()].as_nice_string(sect))
>          return output.getvalue()
>
>
>
>
> _______________________________________________
> Spambayes-checkins mailing list
> Spambayes-checkins at python.org
> http://mail.python.org/mailman/listinfo/spambayes-checkins
>



-- 

Vous exprimer; Exprésese; Te stesso esprimere; Express yourself!
Tim Stone
See my photography at www.fourstonesExpressions.com
See my writing at www.xanga.com/obj3kshun



More information about the Spambayes-checkins mailing list