Back to index

plone3  3.1.7
Classes | Functions | Variables
PluggableAuthService.UserPropertySheet Namespace Reference

Classes

class  UserPropertySheet

Functions

def _guessSchema

Variables

tuple StringTypes = ( StringType, UnicodeType )
tuple _SequenceTypes = ( TupleType, ListType )

Function Documentation

Definition at line 45 of file UserPropertySheet.py.

00045 
00046 def _guessSchema( kw ):
00047 
00048     schema = []
00049     for k, v in kw.items():
00050 
00051         ptype = 'string'
00052 
00053         if type( v ) is IntType:
00054             ptype = 'int'
00055 
00056         elif type( v ) is FloatType:
00057             ptype = 'float'
00058 
00059         elif type( v ) is LongType:
00060             ptype = 'long'
00061 
00062         elif type( v ) is BooleanType:
00063             ptype = 'boolean'
00064 
00065         elif type( v ) in _SequenceTypes:
00066 
00067             if v and type( v[0] ) not in StringTypes:
00068                 raise ValueError, 'Property %s: sequence items not strings' % k
00069 
00070             ptype = 'lines'
00071 
00072         elif type( v ) is InstanceType:
00073 
00074             if isinstance( v, DateTime ):
00075                 ptype = 'date'
00076             else:
00077                 raise ValueError, 'Property %s: unknown class' % k
00078 
00079         elif isinstance( v, Image ):
00080             ptype = 'image'
00081 
00082         elif type( v ) not in StringTypes:
00083             raise ValueError, 'Property %s: unknown type' % k
00084 
00085         schema.append( ( k, ptype ) )
00086 
00087     return schema


Variable Documentation

Definition at line 34 of file UserPropertySheet.py.

tuple PluggableAuthService.UserPropertySheet.StringTypes = ( StringType, UnicodeType )

Definition at line 32 of file UserPropertySheet.py.