[Checkins] SVN: PluggableAuthService/trunk/ * adding support for boolean types to UserPropertySheet

Rob Miller ra at burningman.com
Wed Mar 29 15:51:00 EST 2006


Log message for revision 66262:
  * adding support for boolean types to UserPropertySheet
  
  

Changed:
  U   PluggableAuthService/trunk/UserPropertySheet.py
  U   PluggableAuthService/trunk/tests/test_UserPropertySheet.py

-=-
Modified: PluggableAuthService/trunk/UserPropertySheet.py
===================================================================
--- PluggableAuthService/trunk/UserPropertySheet.py	2006-03-29 18:16:01 UTC (rev 66261)
+++ PluggableAuthService/trunk/UserPropertySheet.py	2006-03-29 20:50:59 UTC (rev 66262)
@@ -22,6 +22,7 @@
 from types import TupleType
 from types import ListType
 from types import InstanceType
+from types import BooleanType
 
 try:
     from types import StringTypes
@@ -55,6 +56,9 @@
         elif type( v ) is LongType:
             ptype = 'long'
 
+        elif type( v ) is BooleanType:
+            ptype = 'boolean'
+
         elif type( v ) in _SequenceTypes:
 
             if v and type( v[0] ) not in StringTypes:

Modified: PluggableAuthService/trunk/tests/test_UserPropertySheet.py
===================================================================
--- PluggableAuthService/trunk/tests/test_UserPropertySheet.py	2006-03-29 18:16:01 UTC (rev 66261)
+++ PluggableAuthService/trunk/tests/test_UserPropertySheet.py	2006-03-29 20:50:59 UTC (rev 66262)
@@ -28,6 +28,7 @@
               , ( 'd', 'date'    )
               , ( 'l', 'lines'   )
               , ( 't', 'lines'   )
+              , ( 'b', 'boolean' )
               )
 
     _STRING_VALUE = 'string'
@@ -37,6 +38,7 @@
     _DATE_VALUE = DateTime()
     _LIST_VALUE = [ 'a', 'b', 'c' ]
     _TUPLE_VALUE = ( 'd', 'e', 'f' )
+    _BOOL_VALUE = True
 
     def _getTargetClass( self ):
 
@@ -78,6 +80,7 @@
         self.failUnless( ups.hasProperty( 'd' ) )
         self.failUnless( ups.hasProperty( 'l' ) )
         self.failUnless( ups.hasProperty( 't' ) )
+        self.failUnless( ups.hasProperty( 'b' ) )
 
         self.assertEqual( ups.getPropertyType( 's' ), 'string' )
         self.assertEqual( ups.propertyInfo( 's' )[ 'type' ], 'string' )
@@ -99,6 +102,10 @@
         self.assertEqual( ups.propertyInfo( 'd' )[ 'type' ], 'date' )
         self.assertEqual( ups.getProperty( 'd' ), self._DATE_VALUE )
 
+        self.assertEqual( ups.getPropertyType( 'b' ), 'boolean' )
+        self.assertEqual( ups.propertyInfo( 'b' )[ 'type' ], 'boolean' )
+        self.assertEqual( ups.getProperty( 'b' ), self._BOOL_VALUE )
+
         self.assertEqual( ups.getPropertyType( 'l' ), 'lines' )
         self.assertEqual( ups.propertyInfo( 'l' )[ 'type' ], 'lines' )
 
@@ -140,6 +147,7 @@
                            , d=self._DATE_VALUE
                            , l=self._LIST_VALUE
                            , t=self._TUPLE_VALUE
+                           , b=self._BOOL_VALUE
                            )
 
         self._checkStockSchema( ups )
@@ -156,6 +164,7 @@
                            , d=self._DATE_VALUE
                            , l=self._LIST_VALUE
                            , t=self._TUPLE_VALUE
+                           , b=self._BOOL_VALUE
                            )
 
         self._checkStockSchema( ups )



More information about the Checkins mailing list