src/pyams_utils/schema.py
changeset 32 c784991b55a4
parent 1 3f89629b9e54
child 36 7398e25bad99
equal deleted inserted replaced
31:31d5cfdbd741 32:c784991b55a4
    15 
    15 
    16 # import standard library
    16 # import standard library
    17 import string
    17 import string
    18 
    18 
    19 # import interfaces
    19 # import interfaces
    20 from zope.schema.interfaces import ITextLine, IDecimal, IList, ITuple, IPassword
    20 from zope.schema.interfaces import ITextLine, IDecimal, IList, IDict, ITuple, IPassword
    21 
    21 
    22 # import Zope3 packages
    22 # import Zope3 packages
       
    23 from persistent.list import PersistentList as PersistentListType
       
    24 from persistent.mapping import PersistentMapping
    23 from zope.interface import implementer
    25 from zope.interface import implementer
    24 from zope.schema import TextLine, Decimal, List, Tuple, Password, ValidationError
    26 from zope.schema import TextLine, Decimal, List, Dict, Tuple, Password, ValidationError
    25 
    27 
    26 # import local packages
    28 # import local packages
    27 
    29 
    28 from pyams_utils import _
    30 from pyams_utils import _
       
    31 
       
    32 
       
    33 #
       
    34 # Persistent list field
       
    35 #
       
    36 
       
    37 class IPersistentList(IList):
       
    38     """Persistent list field marker interface"""
       
    39 
       
    40 
       
    41 @implementer(IPersistentList)
       
    42 class PersistentList(List):
       
    43     """Persistent list field"""
       
    44 
       
    45     _type = PersistentListType
       
    46 
       
    47 
       
    48 #
       
    49 # Persistent mapping field
       
    50 #
       
    51 
       
    52 class IPersistentDict(IDict):
       
    53     """Persistent mapping field marker interface"""
       
    54 
       
    55 
       
    56 @implementer(IPersistentDict)
       
    57 class PersistentDict(Dict):
       
    58     """Persistent mapping field"""
       
    59 
       
    60     _type = PersistentMapping
    29 
    61 
    30 
    62 
    31 #
    63 #
    32 # Encoded password field
    64 # Encoded password field
    33 #
    65 #