[Spambayes-checkins] spambayes/Outlook2000 config.py,1.23,1.24

Mark Hammond mhammond at users.sourceforge.net
Thu Aug 21 07:08:50 EDT 2003


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

Modified Files:
	config.py 
Log Message:
Prevent accidental creation of top-level 'sections' (and add tests for it)


Index: config.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/config.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** config.py	19 Aug 2003 13:31:35 -0000	1.23
--- config.py	21 Aug 2003 13:08:48 -0000	1.24
***************
*** 276,279 ****
--- 276,281 ----
                  return container
          raise AttributeError, "Options has no section '%s'" % attr
+     def __setattr__(self, attr, val):
+         raise AttributeError, "No section [%s]" % attr
  
  def CreateConfig(defaults=defaults):
***************
*** 319,323 ****
      for i in f:
          print i, type(i)
!     
      # Test single ID folders.
      if c.filter.unsure_folder_id is not None:
--- 321,339 ----
      for i in f:
          print i, type(i)
! 
!     try:
!         c.filter.oops = "Foo"
!     except (AttributeError,KeyError): # whatever :)
!         pass
!     else:
!         print "ERROR: I was able to set an invalid sub-property!"
! 
!     try:
!         c.oops = "Foo"
!     except (AttributeError,KeyError): # whatever :)
!         pass
!     else:
!         print "ERROR: I was able to set an invalid top-level property!"
! 
      # Test single ID folders.
      if c.filter.unsure_folder_id is not None:





More information about the Spambayes-checkins mailing list